 | |  | | | Classifieds Bug Reports Post any problems you may be having with Classifieds here. |
September 11th, 2008, 11:37 AM
|
#1 (permalink)
| | Member Verified Customer
Join Date: Apr 2005
Posts: 34
| Changing an Ad's category doesn't check for existing images
We recently discovered a bug with moving an ad to a different category. The ad that gets moved is fine, however if there is already an existing ad in that category that has an image with the same filename as an image from the moved ad, that file gets overwritten and now two ads share the same image(s).
I checked pp-inc.php and noticed the move_image function just copies the file over instead of doing a file_exists check like the handleupload function does in image-inc.php
|
| |
September 11th, 2008, 07:01 PM
|
#2 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 68,069
|
Actually the file checking is done on image upload so there should never be files with the same name and its done in bulkupload
|
| |
September 12th, 2008, 06:04 PM
|
#3 (permalink)
| | Member Verified Customer
Join Date: Apr 2005
Posts: 34
|
The file checking is only done for the category the ad is first uploaded into. Once the ad is already in the classifieds system, if you change an ad's category, it moves the images over to the new category's directory -- where an image with the same filename might already exist.
|
| |
September 12th, 2008, 06:09 PM
|
#4 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 68,069
|
Actually that would be incorrect as far as I see in the code. When an image is uploaded we check the entire products table to make sure an image in every single bigimage field does not exist and rename the image accordingly
This comes right from bulkupload.php which handles every single image uploaded Code: Content visible to verified customers only.
|
| |
September 12th, 2008, 06:24 PM
|
#5 (permalink)
| | Member Verified Customer
Join Date: Apr 2005
Posts: 34
|
I'm talking about moving an ad after it, along with its images, has already been uploaded.
Both the adm-misc.php and editproduct.php scripts call the move_image_cat function, which then calls the move_image function and no where along the way does it check to see if that filename already exists in the new category's directory.
|
| |
September 12th, 2008, 06:25 PM
|
#6 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 68,069
|
what I am saying here though is if an ad image can never have the same name as any image already present then how would moving it create an issue?
I know what your saying but I dont see anyway an ad can have the same name so this should not be an issue unless your running a way old version of classifieds I am not looking at code from here
|
| |
September 12th, 2008, 06:33 PM
|
#7 (permalink)
| | Member Verified Customer
Join Date: Apr 2005
Posts: 34
|
Ahh... okay, I now understand what you're talking about.
However, the handleupload function in the image-inc.php script doesn't handle the image files the same way -- it only checks the ad's category directory for the file and not the actual products table like the bulkupload.php script does. That is where the problem is coming from that we're currently experiencing and I initially posted about.
As an example, someone uploads an ad with a really common filename, then we find that ad would be more suitable in a different category so we move it, only to wipe out an existing ad's photo that is named the same with this moved-ad's photo.
|
| |
September 12th, 2008, 08:07 PM
|
#8 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 68,069
|
in handleupload try changing this Code: Content visible to verified customers only.
to this Code: Content visible to verified customers only.
|
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Rate This Thread | Linear Mode | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -5. The time now is 04:22 AM. | |