Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

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

Seems this was reported and fixed a while back #2337 and there is a test, marked as xfail

OmeroPy/test/integration/test_files.py

@pytest.mark.xfail(reason="ticket 11610")
def testUploadDifferentSizeTicket2337(self):
    ...

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.

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.62909 sec.)

We're Hiring!