diff options
| author | Jonathan Amsterdam <jba@google.com> | 2020-08-18 09:25:39 -0400 |
|---|---|---|
| committer | Jonathan Amsterdam <jba@google.com> | 2020-08-18 13:37:16 +0000 |
| commit | 23ec2ddea295b4d17f6f372c0f31460f3df85b53 (patch) | |
| tree | 5bf710f497c7a1afc2119c6164af829b54cf711c /internal/postgres/insert_module.go | |
| parent | 42d0b044bd63893571d2c23cdf6b84091e301ea5 (diff) | |
| download | go-x-pkgsite-23ec2ddea295b4d17f6f372c0f31460f3df85b53.tar.xz | |
internal/postgres: don't insert contents of non-redistributable licenses
Do not store the contents of a license in the DB if the license does
not allow redistribution.
Change-Id: I8c3a230f400ad3b4f6492e693dda5e84aa648bdd
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/248957
Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/postgres/insert_module.go')
| -rw-r--r-- | internal/postgres/insert_module.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/postgres/insert_module.go b/internal/postgres/insert_module.go index 512c803b..f292feb8 100644 --- a/internal/postgres/insert_module.go +++ b/internal/postgres/insert_module.go @@ -25,6 +25,7 @@ import ( "golang.org/x/pkgsite/internal" "golang.org/x/pkgsite/internal/database" "golang.org/x/pkgsite/internal/derrors" + "golang.org/x/pkgsite/internal/licenses" "golang.org/x/pkgsite/internal/log" "golang.org/x/pkgsite/internal/stdlib" "golang.org/x/pkgsite/internal/version" @@ -713,6 +714,11 @@ func removeNonDistributableData(m *internal.Module) { } } } + for _, l := range m.Licenses { + if !licenses.Redistributable(l.Types) { + l.Contents = nil + } + } } // DeleteModule deletes a Version from the database. |
