download-directory / download-directory.github.io

Web App: Download just a sub directory from a GitHub repo.
https://download-directory.github.io
MIT License
1.25k stars 117 forks source link

Add support for Git LFS #106

Closed FoxRefire closed 9 months ago

FoxRefire commented 9 months ago

Fixes #42

netlify[bot] commented 9 months ago

Deploy Preview for preview-for-download-directory-github-io ready!

Name Link
Latest commit 084914e3523f68bb428e61863f2c9be62200c714
Latest deploy log https://app.netlify.com/sites/preview-for-download-directory-github-io/deploys/65b366e83ed4de0007a55fa0
Deploy Preview https://deploy-preview-106--preview-for-download-directory-github-io.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

fregante commented 9 months ago

Thank you for the PR, but it doesn't work, you can try using live preview deployment

https://deploy-preview-105--preview-for-download-directory-github-io.netlify.app/?url=https%3A%2F%2Fgithub.com%2Fjgarside1678%2FT9%2Ftree%2Fmaster%2FContent%2FUnits%2FAlliance%2FAnimations%2FMageAnimationSet%2FAnimations%2FInPlace

See the last attempt for more context:

FoxRefire commented 9 months ago

Ah yeah,you are true. I only tested with directory that have only 1 file. https://deploy-preview-106--preview-for-download-directory-github-io.netlify.app/?url=https%3A%2F%2Fgithub.com%2FMacumba45%2FTestingLFStorage-%2Ftree%2Fmain%2Fpublic%2Fassets

As you said,It fails when multiple files due to the f*ing Javascript spec that once a stream is loaded, re-use is locked. I'm WIP to fix this.

FoxRefire commented 9 months ago

Fixed

FoxRefire commented 9 months ago

I've thought of another approach. If file isn't LFS,media.githubusercontent.com returns 404. ex)https://media.githubusercontent.com/media/download-directory/download-directory.github.io/main/readme.md So response.ok will be false. What do you think about the idea of using this to try to get the file from media.githubusercontent.com first, and if this fails, then from raw.githubusercontent.com?

fregante commented 9 months ago

Likewise that affects everyone just to support the vast minority of usage, so we can't do that

FoxRefire commented 9 months ago

Fixed issue #35

https://github.com/PaperMC/Paper/tree/feature/daemon/scripts

https://deploy-preview-106--preview-for-download-directory-github-io.netlify.app/?url=https%3A%2F%2Fgithub.com%2FPaperMC%2FPaper%2Ftree%2Ffeature%2Fdaemon%2Fscripts

fregante commented 9 months ago

Please address one issue at a time, in separate PRs

FoxRefire commented 9 months ago

Okay

fregante commented 9 months ago

As mentioned, revert the changes related to #35 first. And that's missing the core change I wanted to see: detection via headers

FoxRefire commented 9 months ago

Tested with:

Non-LFS(with 135B file): https://github.com/download-directory/download-directory.github.io/tree/main/.github
Non-LFS: https://github.com/fregante/GhostText/tree/main/safari
LFS: https://github.com/jgarside1678/T9/tree/master/Content/Units/Alliance/Animations/MageAnimationSet/Animations/InPlace
LFS(Big 200M file): https://github.com/Macumba45/TestingLFStorage-/tree/main/public/assets
Non-LFS(slash-blanch): https://github.com/PaperMC/Paper/tree/feature/daemon/scripts

Everything works correctly except slash-blanch because of reverted https://github.com/FoxRefire/download-directory.github.io/commit/21acdd680a647dec2c49ee47e705f05537b37086

fregante commented 9 months ago

Thank you for your contribution!

Everything works correctly except slash-blanch because of reverted FoxRefire@21acdd6

Can you open a new PR?