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

Serve a tarball containing the contents of a given directory. #53

Merged
merged 9 commits into from Feb 22, 2022

Conversation

michaelkaye
Copy link
Contributor

This will make it easier to get all logs for a given bug; preventing users
needing to run scripts to download all files.

  • we cannot make the link exist in the directory listing as there are scripts
    that automate downloads which would pick this up.

  • Unsure if "?format=tar.gz" is the right option to enable this; I couldn't think
    of something easy to do but hard to not get picked up by existing automation, and
    wouldn't conflict with existing filenames. Suggestions welcome.

This will make it easier to get all logs for a given bug; preventing users
needing to run scripts to download all files.

 - we cannot make the link exist in the directory listing as there are scripts
   that automate downloads which would pick this up.

 - Unsure if "?format=tar.gz" is the right option to enable this; I couldn't think
   of something easy to do but hard to not get picked up by existing automation, and
   wouldn't conflict with existing filenames.
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks generally sensible.

Suggestions:

logserver.go Show resolved Hide resolved
logserver.go Outdated Show resolved Hide resolved
logserver.go Outdated Show resolved Hide resolved
logserver.go Show resolved Hide resolved
logserver.go Outdated Show resolved Hide resolved
logserver.go Show resolved Hide resolved
@richvdh
Copy link
Member

richvdh commented Feb 10, 2022

Another suggestion: use a completely different endpoint (eg /api/archive/...). YMMV.

@michaelkaye
Copy link
Contributor Author

Another suggestion: use a completely different endpoint (eg /api/archive/...). YMMV.

I thought about this; my logic is that if you are looking at a directory listing, it's easier to add a ?format=tar.gz on the end than change endpoint.

@michaelkaye
Copy link
Contributor Author

Oh, and explicitly not adding the tarball to the github issues for now, i want to get the ability to download working in production before we start scattering links to it (in case we do want to change it to /archive or whatever)

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm otherwise

log.Println("Serving directory listing of", path)
http.ServeFile(w, r, path)
return
serveDirectory(w, r, path)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs a return ? (or you need to guard the rest of it with an else)

logserver.go Outdated
}
log.Println("Serving directory listing of", path)
http.ServeFile(w, r, path)
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this return is redundant

@michaelkaye michaelkaye merged commit b01b5a5 into master Feb 22, 2022
@michaelkaye michaelkaye deleted the michaelk/tarball_of_files branch February 22, 2022 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants