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

Implement upload check for #481 #579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Distribution/Server/Features/Upload.hs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ uploadFeature ServerEnv{serverBlobStore = store}
_ | packageExists state pkg && not (uid `Group.member` pkgGroup)
-> uploadError (notMaintainer pkg)

-- minor hack: here we exploit the side-effect of package
-- candidates giving rise to a maintainers group;
| not (packageExists state pkg) && not (uid `Group.member` pkgGroup)
-> uploadError noCandidateInit

| packageIdExists state pkg
-> uploadError versionExists

Expand Down Expand Up @@ -367,6 +372,10 @@ uploadFeature ServerEnv{serverBlobStore = store}
++ "package, then ask an existing maintainer to add you to the group. If "
++ "this is a package name clash, please pick another name or talk to the "
++ "maintainers of the existing package."
noCandidateInit = "The very first release of a new package must be uploaded as a "
++ "package candidate before it can be published to the primary package "
++ "index.\n\nThis is a safeguard against unintended uploads of packages, "
++ "as deleting accidentally published packages is not supported."

-- This function generically extracts a package, useful for uploading, checking,
-- and anything else in the standard user-upload pipeline.
Expand Down