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

[16.0][FIX] fs_attachment: fix fs_url computing #404

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

Conversation

kobros-tech
Copy link

@kobros-tech kobros-tech commented Oct 10, 2024

  • Assuming that the optimized directory is checked and the directory path is not checked:
    • If the image is checked as obfuscated:

      • then the fs_url refers to the image in its/dir1/dir2 directories that are named from checksum first 4 digits and this is fine.
    • But, if the image is not obfuscated:

      • then the "_get_url_for_attachment" method still computes the default method, forgetting that the fs_filename is the readable name and not obfuscated.

      I had to add the /dir1/dir2 to generate the correct URL

Screenshot from 2024-10-10 20-42-24
Screenshot from 2024-10-10 20-42-09
Screenshot from 2024-10-10 20-41-51

The module still needs testing and debugging, many tests failed and I see that store_fname is neglecting the directory path although it can be added like in my case.

I am looking forward to continuing debugging with assistance from the contributors.

Thanks All...

@kobros-tech
Copy link
Author

)

# Create a mock image filestore
fs_storage = self.env["fs.storage"].create(
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the protocol of your storage? Protocol is a required field and there is nor more default value on it on the 16.0 branch. Be careful to don't serve your images from the odoo's filestore in a public way. If you configure your proxy to get access to the filestore under the 'images' path, you expose all the files from your odoo instance....

Copy link
Author

Choose a reason for hiding this comment

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

@lmignon

Thanks for clarifying, but I use different filestore for only products imsges thumbnails.

But the bug is completely different from these settings that you mentioned.

I can use many protocols and to test I used file protocol.

Thanks

Copy link
Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

Thank you for the fix @kobros-tech LGTM (Code review only)

@sbidoul sbidoul added this to the 16.0 milestone Oct 15, 2024
@sbidoul sbidoul changed the title [FIX] fs_attachment: fix fs_url computing [16.0][FIX] fs_attachment: fix fs_url computing Oct 15, 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.

3 participants