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

Comments

@jba
Copy link
Contributor

@jba 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
@amarjeetanandsingh
Copy link

@amarjeetanandsingh 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 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

@gopherbot gopherbot commented Jul 24, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants