Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1393 closed enhancement (fixed)

The "Edit file" function should check the size after loading/before saving

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 2.13.1
Component: web Version:
Keywords: Cc:

Description (last modified by Nicklas Nordborg)

The "Edit file" function is useful for editing text files below 100kb in size. There have been reports that part of the file content is lost during the editing. We have been unable to reproduce this loss, but we should add checks in the code to make sure that:

  1. The complete file is received by the edit window
  2. The complete content of the edit window is sent back to the server

For more information set the mailing list discussion:

Change History (7)

comment:1 by Nicklas Nordborg, 15 years ago

Hmmm... I just realized that checking the number of bytes received/sent by the server is not going to help since this doesn't have to be the same number as the number of characters in the form. It all depends on the character set used by the file.

Hmmm... could this be what is causing the problems? I have made my tests with an ISO-8859-1 file.

comment:2 by Nicklas Nordborg, 15 years ago

Tested with an UTF-8 encoded file and there is no problem with it either.

The above statement about checking sizes only applies when loading the file. When saving the file we are working with character-based streams which means that we should be able to compare the character count on the server with the character count in the web client.

comment:3 by Nicklas Nordborg, 15 years ago

Description: modified (diff)

comment:4 by Nicklas Nordborg, 15 years ago

It is something on the server side. I made a test on the production server and now I get the same problem with truncation. It seems like it truncates the file size to the nearest power of 2 (in kilobytes). Eg. a file between 32 and 64k is truncated to 32k. A file between 16 and 32k is truncated to 16k. Truncation stops at 8k.

comment:5 by Nicklas Nordborg, 15 years ago

I can reproduce this on my development machine now. But only after downloading and installing Tomcat 6.0.16. I used to have Tomcat 6.0.20 and there was no problem. The production server is using Tomcat 6.0.16.

I also noted that the numbers above are not the entire truth. Sometimes I got truncation at 48k and at 24k.

comment:6 by Nicklas Nordborg, 15 years ago

Resolution: fixed
Status: newclosed

(In [5112]) Fixes #1393: The "Edit file" function should check the size after loading/before saving

The file is checked when saving. It is not possible to check when loading since at that time we only know the number of bytes, not the number of characters.

comment:7 by Jari Häkkinen, 15 years ago

(In [5113]) Refs #1393. Bumped tomcat version requirement.

Note: See TracTickets for help on using tickets.