Zibbp / ganymede

Twitch VOD and Live Stream archiving platform. Includes a rendered and real-time chat for each archive.
https://github.com/Zibbp/ganymede
GNU General Public License v3.0
494 stars 25 forks source link

File/folder paths break when # is in path #250

Closed russelg closed 1 year ago

russelg commented 1 year ago

My folder template is {{date}} - {{title}} [{{id}}][{{type}}][{{uuid}}] and my file template is {{title}} [{{id}}].

This can (and does) break when a stream has a # in the title, e.g. Midnight Snacks #955: 07.12.23 - presented by W.T. Snacks.

This results in requests like so: /vods/midnightsnacksfm/2023-07-12%20-%20Midnight_Snacks_#955__07.12.23_-_presented_by_W.T._Snacks%20[48844459693][live][6ce097e2-2068-11ee-9b03-0242ac120005]/Midnight_Snacks_#955__07.12.23_-_presented_by_W.T._Snacks%20[48844459693]-thumbnail.jpg.

The browser strips the # for the server request, and the end URL is /vods/midnightsnacksfm/2023-07-12%20-%20Midnight_Snacks_

I think it would be satisfactory to either escape the URL where it is used or add # to utils.SanitizeFileName. # is a valid filename character, so I would think making sure the URL is escaped correctly would be the correct solution here.

Zibbp commented 1 year ago

Ah, the dreaded #. I think the best way to fix this is escape the URL in the frontend rather than sanitize it on the backend. A # is a valid filename character like you said so I'd rather keep it for files.

Zibbp commented 1 year ago

I merged https://github.com/Zibbp/ganymede-frontend/pull/13 and is available on the :main image tag for the frontend if you'd like to try it out.

russelg commented 1 year ago

Just tested it, works great. Thanks for fixing it so quickly!