Skip to content

Get-file web server route now support streaming #9078

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

linonetwo
Copy link
Contributor

@linonetwo linonetwo commented Jun 5, 2025

Support video Range HTTP header and straming large file. I've tested it, now video in ./files folder can be loaded partially with 206 Partial Content, also allow downloader to resume download things.

This will add more code to the core, so I make it a separate PR incase you don't like it. I currently only need #9075 , and this PR is only a byproduct.

I'm not sure how we could add test for server route. I test this manually with agent like this:

图片

Copy link

netlify bot commented Jun 5, 2025

Deploy Preview for tiddlywiki-previews ready!

Name Link
🔨 Latest commit bac2bea
🔍 Latest deploy log https://app.netlify.com/projects/tiddlywiki-previews/deploys/6847030009bf0c00080c0922
😎 Deploy Preview https://deploy-preview-9078--tiddlywiki-previews.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 project configuration.

Copy link

github-actions bot commented Jun 5, 2025

Confirmed: linonetwo has already signed the Contributor License Agreement (see contributing.md)

Copy link

github-actions bot commented Jun 5, 2025

📊 Build Size Comparison: empty.html

Branch Size
Base (master) 2527.2 KB
PR 2528.5 KB

Diff: ⬆️ Increase: +1.3 KB

status = 404;
content = "File '" + suppliedFilename + "' not found";
if(path.relative(baseFilename,filename).indexOf("..") === 0) {
return state.sendResponse(403,{"Content-Type": "text/plain"},"Access denied");
Copy link
Member

Choose a reason for hiding this comment

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

Sending a 403 response is not a backwards compatible change. In general I think we should prefer 404 because 403 is apt to reveal information about the existence of resources.

Copy link
Contributor Author

@linonetwo linonetwo Jun 9, 2025

Choose a reason for hiding this comment

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

Okay, I also update the put-file for this. Consistent behavior across GET/PUT routes.

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.

2 participants