[16.0] fs_attachment: fix meaningful name rewriting#312
Conversation
|
Hi @lmignon, |
lmignon
left a comment
There was a problem hiding this comment.
Thank you @len-foss LGTM (Code review)
I wonder if this behaviour also works correctly when using the 'file like' api to modify the contents of the attachment....
with attachment.open("wb") as f:
f.write(...)
Nevertheless, can you add a file named 312.bugfix into the fs_attachment/readme/newsfragment directory to describe the change in an 'end user 'oriented way. This description will be add to the history section of the module description at merge
|
I'm very confused, as the newly added test breaks on the Let's take a bit more time to understand where the issue is coming from, unless you already have some pointer? |
The tests are failing due to the env cleanup at transaction rollback after each test. Indeed, the fs.storage backend inherit from the server.env.mixin. Therefore some fields are pseudo computed fields and need to be reset before running each test. To fix your issue, you need to update your created fs.storage record into the def setUp(self)::
super().setUp()
self.backend_optimized = write(
{
"protocol": "file",
"code": "tmp_opt",
"directory_path": temp_dir,
"optimizes_directory_path": True,
}
) |
c88a455 to
97b6625
Compare
|
Oh, thank you very much! We should be good now then :-) |
lmignon
left a comment
There was a problem hiding this comment.
A little comment otherwise LGTM (Code review).
Thank you for the contrib. Don't forget to add you name into the contributor list 😏
Let "image.png" be an image. Thumbnails might be created with a path such as "38/5b/image-128.png". Before, the path was forgotten when updating the attachment, so accessing the file would crash, making the record inaccessible.
97b6625 to
c243f68
Compare
|
All right. I have added this to the test and a bit more explanations to make it easier to check the assumptions. |
|
/ocabot merge patch |
|
What a great day to merge this nice PR. Let's do it! |
|
Congratulations, your PR was merged at ad8a4d3. Thanks a lot for contributing to OCA. ❤️ |
This fix the name rewriting in case the storage is "directory name optimized".
It adds a test to ensure that the name is consistently used between write and read.
Closes #285