1
0
Fork 0
mirror of https://github.com/requarks/wiki.git synced 2026-03-02 22:06:55 -05:00

error: Invalid character in header content ["Content-disposition"] #2554

Closed
opened 2026-02-20 19:07:06 -05:00 by deekerman · 6 comments
Owner

Originally created by @0v3rd0z3d on GitHub (Jan 24, 2022).

Discussed in https://github.com/Requarks/wiki/discussions/4929

Originally posted by 0v3rd0z3d January 24, 2022
image
image
Acquired an"internal server error" while trying to open assets. Names are in Russian characters.
Not having this error with filenames in english characters.
Versions of wikijs with this issue: 2.5.268, 2.5.272
Not having this error in version: 2.5.201
Thank you in advance!

Originally created by @0v3rd0z3d on GitHub (Jan 24, 2022). ### Discussed in https://github.com/Requarks/wiki/discussions/4929 <div type='discussions-op-text'> <sup>Originally posted by **0v3rd0z3d** January 24, 2022</sup> ![image](https://user-images.githubusercontent.com/65501113/150765398-db697628-c45c-495b-a3d0-d0cf84c02a73.png) ![image](https://user-images.githubusercontent.com/65501113/150765497-7eff5aff-7eab-4d73-b260-56ba28418f21.png) Acquired an"internal server error" while trying to open assets. Names are in Russian characters. Not having this error with filenames in english characters. Versions of wikijs with this issue: 2.5.268, 2.5.272 Not having this error in version: 2.5.201 Thank you in advance!</div>
Author
Owner

@dcfreedom commented on GitHub (Jan 25, 2022):

Same issue here. But file name is in Traditional Chinese.

@dcfreedom commented on GitHub (Jan 25, 2022): Same issue here. But file name is in Traditional Chinese.
Author
Owner

@hendrikma commented on GitHub (Mar 21, 2022):

Same issue here.

"ü" (HTML ü // ASCII Code 129) Doesn't work.

"ä" (HTML ä // ASCII Code 132) works 😕

@hendrikma commented on GitHub (Mar 21, 2022): Same issue here. "ü" (HTML &uuml; // ASCII Code 129) Doesn't work. "ä" (HTML &auml; // ASCII Code 132) works 😕
Author
Owner

@MrakoMaks commented on GitHub (Mar 26, 2022):

similarly :(

@MrakoMaks commented on GitHub (Mar 26, 2022): similarly :(
Author
Owner

@dcfreedom commented on GitHub (Apr 1, 2022):

This should fix the issue.

wiki/server/models/assets.js

--- assets.js.old       2022-04-02 04:58:00.161301315 +0800
+++ assets.js   2022-04-02 04:57:28.598543664 +0800
@@ -174,7 +174,7 @@
 
       // Force unsafe extensions to download
       if (WIKI.config.uploads.forceDownload && !['.png', '.apng', '.jpg', '.jpeg', '.gif', '.bmp', '.webp', '.svg'].includes(fileInfo.ext)) {
-       res.set('Content-disposition', 'attachment; filename=' + fileInfo.base)
+       res.set('Content-disposition', 'attachment; filename=' + encodeURIComponent(fileInfo.base))
       }
 
       if (await WIKI.models.assets.getAssetFromCache(assetPath, cachePath, res)) {
@dcfreedom commented on GitHub (Apr 1, 2022): This should fix the issue. wiki/server/models/assets.js ``` --- assets.js.old 2022-04-02 04:58:00.161301315 +0800 +++ assets.js 2022-04-02 04:57:28.598543664 +0800 @@ -174,7 +174,7 @@ // Force unsafe extensions to download if (WIKI.config.uploads.forceDownload && !['.png', '.apng', '.jpg', '.jpeg', '.gif', '.bmp', '.webp', '.svg'].includes(fileInfo.ext)) { - res.set('Content-disposition', 'attachment; filename=' + fileInfo.base) + res.set('Content-disposition', 'attachment; filename=' + encodeURIComponent(fileInfo.base)) } if (await WIKI.models.assets.getAssetFromCache(assetPath, cachePath, res)) { ```
Author
Owner

@NGPixel commented on GitHub (Apr 3, 2022):

@dcfreedom Please submit a PR with the fix.

@NGPixel commented on GitHub (Apr 3, 2022): @dcfreedom Please submit a PR with the fix.
Author
Owner

@NGPixel commented on GitHub (Apr 3, 2022):

Fixed by 05b4053954

@NGPixel commented on GitHub (Apr 3, 2022): Fixed by 05b405395432901c561eff51e8a2b94c6220ac7e
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/wiki-requarks#2554
No description provided.