Skip to content

fix: encode filename when using url prefix for resources#2829

Merged
boojack merged 3 commits intousememos:mainfrom
mudkipme:fix/external-link
Jan 24, 2024
Merged

fix: encode filename when using url prefix for resources#2829
boojack merged 3 commits intousememos:mainfrom
mudkipme:fix/external-link

Conversation

@mudkipme
Copy link
Copy Markdown
Contributor

Fixes #2828

@mudkipme mudkipme requested a review from boojack as a code owner January 23, 2024 17:19
@boojack
Copy link
Copy Markdown
Member

boojack commented Jan 24, 2024

@mudkipme
Copy link
Copy Markdown
Contributor Author

Maybe we can decode it in https://github.com/usememos/memos/blob/main/api/v1/resource.go#L346

Since replacePathTemplate is used by both local storage and S3, encoding filename here will result in percent-encoded filename in local assets folder, which is an unexpected behavior. I also wonder whether S3 SDK or object storage services will double-encoding the '%' character if pass a url-encoded object key.

Copy link
Copy Markdown
Member

@boojack boojack left a comment

Choose a reason for hiding this comment

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

LGTM

@boojack boojack merged commit f654d3c into usememos:main Jan 24, 2024
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.

The externalLink of resources is not URL-encoded when using custom URL prefix for object storage

2 participants