Adium

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#15186 closed defect (fixed)

Fixed a bug of parsing <img> tags while writing chat logs

Reported by: pfung Owned by:
Milestone: Adium 1.5 Component: Logging
Version: 1.5hg Severity: normal
Keywords: Cc:
Patch Status: Accepted

Description

Summary

There is a bug in the AIHTMLDecoder. In the protocols which support inline-images, when I send or receive a message with inline-images, the images have a chance to be lost in the chat log package (xxxx.chatlog) if the package is not yet created. And If an image is sent more than once, only the first one can be logged correctly with the src attribute in the log file (xxxx.xml).

I've found that the creation of chat log package is put in a queue. NSFileManager's method copyItemAtPath:toPath:error: doesn't copy the file to destination if the destination's parent folder doesn't exist. When it's going to copy the image, and the chat log creation is still in the queue, the image will fail to be copied.

And that method doesn't copy the file if the destination file already exists too. So if an image is sent twice, only the first one can be logged correctly.

Steps to reproduce

  1. Login an account of protocol that supports sending/receiving inline-images.
  2. Open an IM chat with a buddy.
  3. Paste an image and send it out.
  4. Open the chat log viewer, you have a chance to see an empty message without the image you sent in the log.
  5. Paste the same image twice and send it out again.
  6. Open the chat log package and view the xml log file.

Expected results

Inline-images should be logged properly.

Actual results

Inline-images are not properly logged.

Regression

N/A

Notes

I've changed the source code in AIHTMLDecoder.m and it works for me. Please review this patch, thanks. Some comments are included.

Attachments (1)

2.diff (1.6 KB) - added by pfung 9 years ago.

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by pfung

comment:1 Changed 9 years ago by Robby

  • Milestone set to Adium 1.5

Wow, you're quick. Thanks! :)

comment:2 Changed 8 years ago by sphynx

Sorry, I don't fully understand where this is used. Is this for custom emoticons (on MSN/Jabber), or inline images on Bonjour?

comment:3 Changed 8 years ago by sphynx

Oh, this is for AIM, did not know that supported inline images. :)

comment:4 Changed 8 years ago by Peter Fung <appfung@…>

  • Resolution set to fixed
  • Status changed from new to closed

(In e59f0f6277d0) Fixed a bug when writing inline images to chat logs

Fixes #15186, r=xnyhps

comment:5 follow-up: Changed 8 years ago by sphynx

I took the liberty of changing your commit message, because there isn't any "parsing" going on while saving this.

Thanks for the patch!

comment:6 Changed 8 years ago by sphynx

  • Patch Status changed from Needs Dev Review to Accepted

comment:7 Changed 8 years ago by Robby

pfung, is "Peter Fung" the name you would like to be credited with?

Last edited 8 years ago by Robby (previous) (diff)

comment:8 in reply to: ↑ 5 Changed 8 years ago by pfung

Replying to sphynx:

I took the liberty of changing your commit message, because there isn't any "parsing" going on while saving this.

Thanks for the patch!

Sorry, the commit message is not accurate. Thanks for accepting it.

PS: "Peter Fung" is the name I would like to be credited with. Thanks.

comment:9 Changed 8 years ago by Robert Vehse

(In 230d8e1fc93f) Changelog and credit Peter Fung for his patches. Refs #15183, refs #15186.

Note: See TracTickets for help on using tickets.