Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: don't save zero-length readmes #40336

Closed
jba opened this issue Jul 21, 2020 · 3 comments
Closed

x/pkgsite: don't save zero-length readmes #40336

jba opened this issue Jul 21, 2020 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Milestone

Comments

@jba
Copy link
Contributor

jba commented Jul 21, 2020

If a readme file is zero-length, don't write it to the DB.

Example: https://github.com/docker/go-connections/blob/master/sockets/README.md

@jba jba added the pkgsite label Jul 21, 2020
@ianlancetaylor ianlancetaylor changed the title don't save zero-length readmes x/pkgsite: don't save zero-length readmes Jul 21, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jul 21, 2020
@julieqiu julieqiu added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 21, 2020
@amarjeetanandsingh
Copy link
Contributor

amarjeetanandsingh commented Jul 22, 2020

Hi @jba

Just to confirm, you mean if the readme file content is empty, there shouldn’t have any entry in readmes table?

If yes, is putting a content check in internal/postgres/insert_module.go would be a good place?
Like adding d.Readme.Contents != "" here would help?

Or we should stop the readme file entry in module while fetching itself? In that I think we need to put content length check here before adding a readme file to a module.

@jba
Copy link
Contributor Author

jba commented Jul 22, 2020

makeValidUnicode can return an empty string given a non-empty one (if it's all zeroes), so I think the check should happen after that call.

@gopherbot
Copy link

Change https://golang.org/cl/244677 mentions this issue: internal/postgres: donnot save zero-length readmes

@golang golang locked and limited conversation to collaborators Jul 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

4 participants