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: the same-storage check in the new pre-sign feature #2860

Merged
merged 4 commits into from Jan 30, 2024
Merged

fix: the same-storage check in the new pre-sign feature #2860

merged 4 commits into from Jan 30, 2024

Conversation

ertuil
Copy link
Contributor

@ertuil ertuil commented Jan 29, 2024

I tried the recent pre-sign feature in #2855 , but it does not work for my Aliyun OSS. In particular, I tried this feature with the latest test docker image with Aliyun OSS. I set presign to true and restarted the container several times. However, it seems that it doesn't work out, as the ExternalUrls are not changed after I saw a 'links pre-signed' message in my log.

After an examination, I find the debug. In the original code, it checks if the endpoint matches the ExternalLinks's hostname. However, it does not work out in my Aliyun OSS cases, and I return the pre-sign link 'As-Is' to the original one.

My endpoint is https://oss-cn-shanghai.aliyuncs.com, while my ExternalLinks's hostname is <bucket-name>.oss-cn-shanghai.aliyuncs.com. Therefore, they can not match with a simple strings.Contain().

What I did:

  • add additional codes to match the endpoint and the resource's ExternalLinks's hostname.
  • disable set the new resource's ACL to 'public_read' if presign (feat: pre-signed URL for S3 storage #2855 ) feature is enabled.

@ertuil ertuil requested a review from boojack as a code owner January 29, 2024 16:00
Copy link
Collaborator

@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 bee6f27 into usememos:main Jan 30, 2024
5 checks passed
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.

None yet

2 participants