Closed Bug 248884 Opened 21 years ago Closed 20 years ago

big calendar (ics more than 64k) is broken

Categories

(Calendar :: General, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: artiip, Assigned: mostafah)

References

()

Details

Attachments

(3 files)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2) Gecko/20040628 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2) Gecko/20040628 big calendar (ics more than 64k) is broken file is truncated on update to magical 64kB size Reproducible: Always Steps to Reproduce: 1. instal big calendar 2. update Actual Results: file is broken Expected Results: not truncate the file and display all events
Confirmed. The problem is in getting the file. When i used it as a local file, all was ok. (but a bit slow...)
Status: UNCONFIRMED → NEW
Ever confirmed: true
The data is truncated at http://lxr.mozilla.org/seamonkey/source/calendar/resources/content/calendarManager.js#689 689 result = String.fromCharCode.apply(this, result); This is the conversion from an array of octets into a string.
A better fix would be to use nsIDownloader. All we want is the file to be saved to disk. Hmm, now i think about it, we do check if it starts with something that at least looks like an ical file. We could do that on the file too, but it means downloading to a temp location etc. http://lxr.mozilla.org/seamonkey/source/netwerk/base/public/nsIDownloader.idl
Re: comment 2: SpiderMonkey has a 64K limit on actual argument count in its bytecode format, and Function.prototype.apply enforces that same limit. We could have String.fromCharCodeArray but this is really a case where you want to avoid going through a JS Array of character codes, then back to a JS string. /be
Re c#4 Perhaps checking [x] data to see if it looks like an iCal file, if it does, abort and re-pull using the Downloader to a file? or something similar?
*** Bug 265162 has been marked as a duplicate of this bug. ***
Patch implementing converting array to string 32k unicode characters at a time (similar to comment #3). (To generate a large calendar for testing, download (don't subscribe) several different calendar files and import them into one, then upload it to a remote site. Before this patch, subscribing to a large remote calendar would produce a local file of only 65535 characters and would not succeed to point of showing events. After this patch, it can become full size, and does show the events.)
Attachment #163935 - Flags: first-review?(mostafah)
I've used the attached patch from comment #8 to successfully be able to download and use my remote calendar file (sunone calendar) which was not working prior to the patch. This was on a Windows workstation, so the bug should be changed to reference all OS's (rather than just Linux)
OS: Linux → All
Hardware: PC → All
Attachment #163935 - Flags: first-review?(mostafah) → first-review+
Fixed in CVS. Thanks.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment on attachment 163935 [details] [diff] [review] calendarManager.js patch getRemoteCalendarText to convert fromCharCode 32k at a time A note and a question: N:Still, a better way to fix this is to use nsIDownloader as stated in comment #4. Q:Could it be possible to have an incorrect result if the slice happens in the middle of a UTF8 character which uses more than one byte?
(In reply to comment #11) > Q:Could it be possible to have an incorrect result if the slice happens in the > middle of a UTF8 character which uses more than one byte? Err, this code has always assumed ISO-8859-1, not UTF-8.
An alternative approach would be to use the news methods introduced in bug 262385. That would require less code changes then nsIDownloader, but will only work on new builds.
Patch to use nsIScriptableUnicodeConverter, wrapped inside try{}, to fallback to the old method in case it fails. It should be more robust against utf8 in the calendar file.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #166692 - Flags: first-review?(mostafah)
Attachment #166692 - Flags: first-review?(mostafah) → first-review+
patch checked in. Should really work now. closing bug (again...)
Status: REOPENED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
Getting javascript warning Warning: variable result hides argument Source File: chrome://calendar/content/calendarManager.js Line: 881, Column: 19 Source Code: var result = unicodeConverter.convertFromByteArray( result, result.length );
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(patch -p 2 -i file.patch) Remove 'var' from in front of assignment to result to fix warning.
Attachment #167596 - Flags: first-review?(mvl)
Attachment #167596 - Flags: first-review?(mvl) → first-review+
patch checked in
Status: REOPENED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
The bugspam monkeys have been set free and are feeding on Calendar :: General. Be afraid for your sanity!
QA Contact: gurganbl → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: