Support optional trailing slash in /browse
#225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #219
In order to decide whether to serve the content with file browser UI or directory browser UI, we have to first know whether the file is a directory or a file by actually extracting the tarball beforehand. Since
https://unpkg.com/browse/react/readme
could either be a file namedreadme
underreact
package root directory or a directory inreact
package.I'm not super happy with the changes here but it works with minimal changes. In the long term, I think we should consider refactor the extracting phase to also acknowledge the approach mentioned in #197. I can work on a POC of that, but maybe later 😅.
CI should be failing due to #220 (comment)