Closed
Bug 134883
Opened 22 years ago
Closed 22 years ago
Image urls changed during publishing must be restored if publishing fails
Categories
(SeaMonkey :: Composer, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla1.0.1
People
(Reporter: cmanske, Assigned: cmanske)
References
Details
(Keywords: dataloss, Whiteboard: publish[adt1 rtm][fixed in trunk and branch],custrtm-)
Attachments
(1 file, 3 obsolete files)
5.58 KB,
patch
|
Brade
:
review+
hewitt
:
superreview+
jud
:
approval+
|
Details | Diff | Splinter Review |
During publishing, image (and other associated file links) are changed to be relative to the new source location. Using Composer publishing, this may include a subdiretory that's not the same as the documents. But if publishing fails, the document url is unchanged, but the image urls are still relatie to the new destination.
Assignee | ||
Comment 1•22 years ago
|
||
I *really* think this issue is important and must be fixed before RTM! If we have any kind of error and don't detect it (i.e., we switch the document to the remote url even though we had a failure), the document is now toast. And the original image links are all lost.
Assignee | ||
Comment 2•22 years ago
|
||
*** Bug 137641 has been marked as a duplicate of this bug. ***
Assignee | ||
Comment 3•22 years ago
|
||
Bug 137641 is a simple example of how we get into trouble by not "undoing" the relative image urls after failing to publish: 1. Create a new Composer file and publish the page via FTP so you are now editing are remote page. Or simply edit an existing page on a site that uses FTP to publish to. 2. Add an image. E.g.: I added one that resulted in the absolute url: file:///M:/Temp/1.gif 3. Publish the page using Publish As and use a non-existent subdirectory for image. E.g.: I used "bad". Publishing will fail, but if double click on image to view it's properties, you'll see the URL is now "bad/1.gif" as a result of making the URL relative to the page source, even though "bad" doesn't exist. Note that there's no image in the preview window because the image cannot be accessed. Note also that the image still appears to be correct in the page because nothing has triggered reloading of page, so user is fooled into thinking image link is correct. 4. Now if you try to publish again, but this time use an existing image subdirectory, publishing will fail because it will never be able to find "bad/1.gif". It will change the image url each time, though! (E.g., it changed to "Test/1.gif" after my testing when I used "Test" as the subdirectory to publish to.) Thus if we don't restore the original image URLs after a publishing failure, the document is always at risk of being corrupted with bad image links and very likely will never be publishable again.
Whiteboard: publish → publish[adt2]
Target Milestone: --- → mozilla1.0
Assignee | ||
Comment 4•22 years ago
|
||
This is not the most efficient way to solve this problem, but it is the safest and smallest code change we can make. We simply save a backup of the HTML source output as a JS string, and use that to rebuild the document when publishing has failed. This is exactly the same code used to build the HTML Source window in normal editing, and how it is reconverted into the DOM document. The performance/memory cost, obviously, is storing a possibley very large (but temporary) string for the source HTML.
Assignee | ||
Comment 5•22 years ago
|
||
reassigning to me
Assignee: brade → cmanske
Severity: normal → critical
Whiteboard: publish[adt1 rtm] → publish[adt1 rtm][FIX IN HAND][need r=,sr=]
Target Milestone: mozilla1.0 → mozilla1.1alpha
Assignee | ||
Comment 6•22 years ago
|
||
Same as v1, just removed lines that turn on debug flags.
Assignee | ||
Updated•22 years ago
|
Attachment #83543 -
Attachment is obsolete: true
Assignee | ||
Comment 7•22 years ago
|
||
I tested this with a 204kbyte file that had 2 images: one at the start and one at the end of the page. First I tested publishing successfully. Then I tested FTP publishing to a non-existent subdirectory and the appropriate error alert dialogs appeared and the publishing dialog showed "Not all files were published" Using "Cancel" in Publish Progress dialog canceled the publishing and restored the image SRC urls correctly.
Status: NEW → ASSIGNED
Assignee | ||
Comment 8•22 years ago
|
||
Added try/catch per review. Added optimization to not save backup if not uploading images
Attachment #83552 -
Attachment is obsolete: true
Comment 9•22 years ago
|
||
Comment on attachment 83575 [details] [diff] [review] patch v3 assuming this patch doesn't introduce any JS warnings for mail or Composer and assuming it doesn't have any serious performance issues, r=brade
Attachment #83575 -
Flags: review+
Assignee | ||
Comment 10•22 years ago
|
||
Update per kin's review: Clear the transaction cache (undo stack) after completely rebuilding the document when we had a publishing error. This is to avoid eating a lot of memory since all nodes in new doc are cached whe we rebuild the document.
Attachment #83575 -
Attachment is obsolete: true
Assignee | ||
Comment 11•22 years ago
|
||
Testing: 1. Create a new Composer page. 2. Insert an image from a local drive. (It will have an absolute "file:" URL) 3. Use "File | Publish As" command to publish and enter a subdirectory to publish to that doesn't exist. Click "Publish" 4. You get the error alert messages such as "550 ... No such file or directory" because of the bad directory. Dismiss all of those messages and click on "Cancel" button in Publish Progress dialog. 5. In the Edit menu, the "Undo" command should be disabled since the undo stack was cleared. 6. Double-click on the image or view page in HTML Source to see that the SRC url for the image you inserted should still be the absolute "file:" url that you picked before.
Assignee | ||
Comment 12•22 years ago
|
||
Comment on attachment 83960 [details] [diff] [review] patch v4 Please ignore: +const gShowDebugOutputStateChange = true; That won't be checked in
Comment 13•22 years ago
|
||
Comment on attachment 83960 [details] [diff] [review] patch v4 please remove the blank spaces on the line after + editor.resetModificationCount(); I wish we had constants in our JS to covert the output flags (256). r=brade
Attachment #83960 -
Flags: review+
Comment 14•22 years ago
|
||
Adding custrtm-; no impact on customization.
Whiteboard: publish[adt1 rtm][FIX IN HAND][need r=,sr=] → publish[adt1 rtm][FIX IN HAND][need r=,sr=],custrtm-
Assignee | ||
Updated•22 years ago
|
Whiteboard: publish[adt1 rtm][FIX IN HAND][need r=,sr=],custrtm- → publish[adt1 rtm][FIX IN HAND][need sr=],custrtm-
Assignee | ||
Updated•22 years ago
|
Target Milestone: mozilla1.1alpha → mozilla1.0.1
Comment 15•22 years ago
|
||
Comment on attachment 83960 [details] [diff] [review] patch v4 sr=hewitt
Attachment #83960 -
Flags: superreview+
Assignee | ||
Comment 16•22 years ago
|
||
checked into trunk. Nominating for checkin for 1.0.1 branch. This is very important, please look at comments #1 and #3
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Keywords: adt1.0.1,
mozilla1.0.1
Resolution: --- → FIXED
Whiteboard: publish[adt1 rtm][FIX IN HAND][need sr=],custrtm- → publish[adt1 rtm][fixed in trunk],custrtm-
Comment 17•22 years ago
|
||
sujay, could you verify this on the trunk?
Assignee | ||
Comment 18•22 years ago
|
||
The best test for verification is clearly defined comment #11.
Assignee | ||
Comment 19•22 years ago
|
||
To test the non-error case: 1. Create a new Composer page. 2. Insert an image from a local drive. (It will have an absolute "file:" URL) 3. Publish to an existing site and select a subdirectory that does exist on the site. All files should publish successfully. 4. Double-click on the image and it should now show a relative SRC URL, e.g., "images\myimage.gif", not the absolute "file://..." url you started with.
Assignee | ||
Comment 20•22 years ago
|
||
Note that the error case of a bad directory must be testing using FTP. HTTP will automatically create the subdirectory and you won't see an error.
Comment 22•22 years ago
|
||
adding adt1.0.1+. Please get drivers approval before checking into the branch.
Comment 23•22 years ago
|
||
please checkin to the 1.0.1 branch. once there remove the "mozilla1.0.1+" keyword and add the "fixed1.0.1" keyword.
Keywords: mozilla1.0.1 → mozilla1.0.1+
Comment 24•22 years ago
|
||
Comment on attachment 83960 [details] [diff] [review] patch v4 assuming the debugoutput=true piece is not hitting the branch, here's the approval.
Attachment #83960 -
Flags: approval+
Assignee | ||
Comment 25•22 years ago
|
||
checked into mozilla1.0.1 branch
Keywords: mozilla1.0.1+ → fixed1.0.1
Whiteboard: publish[adt1 rtm][fixed in trunk],custrtm- → publish[adt1 rtm][fixed in trunk and branch],custrtm-
Assignee | ||
Comment 26•22 years ago
|
||
*** Bug 138060 has been marked as a duplicate of this bug. ***
Assignee | ||
Comment 27•22 years ago
|
||
*** Bug 137641 has been marked as a duplicate of this bug. ***
Comment 28•22 years ago
|
||
verified in 7/17 branch removing fixed1.0.1 keyword
Keywords: fixed1.0.1 → verified1.0.1
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•