[18.0][IMP] fs_attachment: two attachments with same name and content - #640
[18.0][IMP] fs_attachment: two attachments with same name and content#640CRogos wants to merge 1 commit into
Conversation
|
Hi @lmignon, |
e18314f to
a7a8b9f
Compare
lmignon
left a comment
There was a problem hiding this comment.
Thank you for pointing out this use case, which I hadn't anticipated.
There are several factors to consider:
- The same file with the same name can be created in different calls to “create.” (This case is not handled.)
- We need to ensure that deleting an attachment does not delete the file referenced by other attachments (this should not be the case with the garbage collector mechanism)
- We need to ensure that if I write directly to the file (my_file.open()), only the attachment I wrote to is modified. (This should be the case)
| self.ir_attachment_model.create( | ||
| [ | ||
| {"name": "test.txt", "raw": b"content"}, | ||
| {"name": "test.txt", "raw": b"content"}, | ||
| ] | ||
| ) |
There was a problem hiding this comment.
Can you check you've 2 attachment records with 2 different files. If I update one file, the other one should not be changed.
| self.ir_attachment_model.create( | ||
| [ | ||
| {"name": "test2.txt", "raw": b"content"}, | ||
| {"name": "test.txt", "raw": b"content"}, | ||
| ] | ||
| ) |
There was a problem hiding this comment.
OK the command create works but can you check the result. Otherwise your tests is partially useless....
There was a problem hiding this comment.
The previous result was an exception, but I agree we should so some check.
7e721f0 to
d58b1d0
Compare
d58b1d0 to
29894f3
Compare
| self.ir_attachment_model.create( | ||
| [ | ||
| {"name": "test2.txt", "raw": b"content"}, | ||
| {"name": "test.txt", "raw": b"content"}, | ||
| ] | ||
| ) |
There was a problem hiding this comment.
The previous result was an exception, but I agree we should so some check.
| self.ir_attachment_model.create( | ||
| [ | ||
| {"name": "test.txt", "raw": b"content"}, | ||
| {"name": "test.txt", "raw": b"content"}, | ||
| ] | ||
| ) |
related to: #639