Task #11751 (closed)
Opened 10 years ago
Closed 10 years ago
Bug: Shortening OriginalFile
Reported by: | wmoore | Owned by: | wmoore |
---|---|---|---|
Priority: | critical | Milestone: | 5.0.0-rc1 |
Component: | Services | Version: | n.a. |
Keywords: | n.a. | Cc: | |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | n.a. |
Sprint: | n.a. |
Description
If I save some text to an OriginalFile? then modify the text to a shorter string (and set the size to the smaller value) and save again... Next time I open the file, the original higher value of size is still saved, and the text I get back from the file contains the short text, then the remainder of the longer text.
This is in FS (not tested in dev_4_4 yet).
Discovered when saving and retrieving webfigure files (storing json in original files).
I'll commit a test soon.
Change History (3)
comment:1 Changed 10 years ago by wmoore
comment:2 Changed 10 years ago by jamoore
- Owner changed from jamoore to wmoore
You'll need to make use of rfs.truncate(). You can either truncate down to zero before you start writing the file or truncate to os.path.getsize() after you've finished writing.
comment:3 Changed 10 years ago by wmoore
- Resolution set to invalid
- Status changed from new to closed
truncate() works fine for me.
Seems this was reported and fixed a while back #2337 and there is a test, marked as xfail