Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

(Bug report) File type video with emoji in name will break the preview #757

Closed
Nriver opened this issue Dec 11, 2024 · 2 comments
Closed

Comments

@Nriver
Copy link
Member

Nriver commented Dec 11, 2024

Description

Darg & drop a small test.mp4 file into note tree. The preview works. Rename it into test😄.mp4.
Refresh and clear cache with Ctrl+F5. The preview is dead.

image

TriliumNext Version

Source code

What operating system are you using?

Other Linux

What is your setup?

Local (no sync)

Operating System Version

Manjaro

Error logs

TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Content-Disposition"]
    at ServerResponse.setHeader (node:_http_outgoing:662:3)
    at Object.exports.setHeader (/home/nate/gitRepo/trilium/node_modules/express-partial-content/src/utils.ts:5:78)
    at Object.exports.setContentDispositionHeader (/home/nate/gitRepo/trilium/node_modules/express-partial-content/src/utils.ts:12:3)
    at <anonymous> (/home/nate/gitRepo/trilium/node_modules/express-partial-content/src/createPartialContentHandler.ts:42:5)
    at Generator.next (<anonymous>)
    at fulfilled (/home/nate/gitRepo/trilium/node_modules/express-partial-content/dist/createPartialContentHandler.js:4:58) {
  code: 'ERR_INVALID_CHAR'
}
@Nriver
Copy link
Member Author

Nriver commented Dec 11, 2024

Related route url

http://127.0.0.1:8080/api/notes/<note id>/open-partial

Route definition

Notes/src/routes/routes.ts

Lines 143 to 144 in 289e33f

route(GET, '/api/notes/:noteId/open-partial', [auth.checkApiAuthOrElectron],
createPartialContentHandler(filesRoute.fileContentProvider, {

Exception is raised in this line
https://github.com/SukantGujar/express-partial-content/blob/f685315681b3941f27aa267e3c64939d0d7e481b/src/createPartialContentHandler.ts#L42
The module hasn't been updated in over 5 years, and it's unlikely we'll receive an update from the upstream.

@eliandoran
Copy link
Contributor

@Nriver , indeed I can reproduce the issue; and ever worse, it's not only for emoji but for any UTF-8 character.
The problem is that I couldn't find any replacement library that does the same thing (apparently streaming HTTP is not so popular?).

I will probably fork it and maintain it on our side, but we'd have to deal with the package management stuff.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants