Skip to content
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

fix: encode filenames before posting to laskugeneraattori #523

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MikaelSiidorow
Copy link
Collaborator

Description

  • fix: encode filenames before posting to laskugeneraattori

Closes #522

Before submitting the PR, please make sure you do the following

  • If your PR is related to a previously discussed issue, please link to it here.
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Make sure the commit history is linear, up-to-date with main branch and does not contain any erroneous changes

Formatting and linting

  • Format code with pnpm format and lint the project with pnpm lint

@MikaelSiidorow MikaelSiidorow linked an issue Oct 14, 2024 that may be closed by this pull request
Copy link
Contributor

@IiroP IiroP left a comment

Choose a reason for hiding this comment

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

Does not work (at least without changes to backend)

image

@lajp
Copy link
Member

lajp commented Oct 15, 2024

I'm not sure how it is done right now but apparently non-ascii characters are to be included, they should be added to the filename* field with the RFC 5987 encoding

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#syntax

You may want to avoid percent escape sequences in filename, because they are handled inconsistently across browsers.

@MikaelSiidorow
Copy link
Collaborator Author

I'm not sure how it is done right now but apparently non-ascii characters are to be included, they should be added to the filename* field with the RFC 5987 encoding

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#syntax

You may want to avoid percent escape sequences in filename, because they are handled inconsistently across browsers.

@lajp I'll take a look. We are using a higher level abstraction with FormData and Fetch, that should do the right thing automatically...

@lajp
Copy link
Member

lajp commented Oct 16, 2024

I found a potential cause for this. Apparently multer, the crate used by axum::extract::Multipart doesn't support the filename*-field: rwf2/multer#52

@MikaelSiidorow
Copy link
Collaborator Author

We could also just slugify the original filenames and strip special characters as a workaround, I doubt that would affect any invoices negatively 🤔 Could do it in similarly like we do with heading IDs for rich text

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.

Handle åäö in filenames (Invoice Generator front)
3 participants