coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 upload => Topic started by: FansCityEu on September 28, 2014, 01:34:44 PM

Title: Can't upload pics with "~"
Post by: FansCityEu on September 28, 2014, 01:34:44 PM
Hi,
I'm trying to upload a picture with batch with this name: 01~242.jpg and it gives me this error (I'm translating it from Spanish so it's similar): "Only files with the following extensions are accepted" and it includes .jpg, if I remove the ~ it works but if not it gave me that error. I have downloaded and uploaded (on ftp) to many pictures to change each one.. :/ What Can I do?
Title: Re: Can't upload pics with "~"
Post by: ron4mac on September 28, 2014, 02:18:28 PM
Update you Coppermine installation to the latest version.
Title: Re: Re: Can't upload pics with "~"
Post by: FansCityEu on September 28, 2014, 03:35:17 PM
Hi,
I have the latest: 1.5.30
Quote from: ron4mac on September 28, 2014, 02:18:28 PM
Update you Coppermine installation to the latest version.
Title: Re: Can't upload pics with "~"
Post by: ron4mac on September 28, 2014, 05:41:13 PM
I've tried to replicate your problem but on my installation of 1.5.30 it functions without any error.
Title: Re: Re: Can't upload pics with "~"
Post by: FansCityEu on September 28, 2014, 05:46:35 PM
I think it's something related with the server or maybe because I'm using GD instead of Imagemagick :/ I don't know but I hate it.
Quote from: ron4mac on September 28, 2014, 05:41:13 PM
I've tried to replicate your problem but on my installation of 1.5.30 it functions without any error.
Title: Re: Can't upload pics with "~"
Post by: ron4mac on September 28, 2014, 06:16:43 PM
Hold on ... I've been able to replicate your issue.  Give me a few hours to come up with a solution for you.
Title: Re: Re: Can't upload pics with "~"
Post by: FansCityEu on September 28, 2014, 06:30:46 PM
Thank you so much!
Quote from: ron4mac on September 28, 2014, 06:16:43 PM
Hold on ... I've been able to replicate your issue.  Give me a few hours to come up with a solution for you.
Title: Re: Can't upload pics with "~"
Post by: ron4mac on September 29, 2014, 12:33:05 AM
Sorry I couldn't get to this sooner ...

This interim patch for the issue you are experiencing is not official.

In the file searchnew.php at about line #106 change:
    $encoded_picfile = base64_encode($picfile);
to:
    $encoded_picfile = urlencode(base64_encode($picfile));

And in the file showthumb.php at about line #141 change:
$matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z\/\\\\_.-\s]+$/');
to: (add a tilde [~] after the lowercase z)
$matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z~\/\\\\_.-\s]+$/');


Anything official involving this would be pending whether ~'s are to be acceptably allowed in file names.
Title: Re: Can't upload pics with "~"
Post by: Αndré on September 29, 2014, 09:17:58 AM
I don't see a reason to disallow the tilde, as it's also used for the HTTP upload forms:
Code (db_input.php) Select
    while (file_exists($dest_dir . $picture_name)) {
        $picture_name = $matches[1] . '~' . $nr++ . '.' . $matches[2];
    }


I'll have a closer look at your patch and add it to our SVN repository, if applicable.
Title: Re: Re: Can't upload pics with "~"
Post by: FansCityEu on September 29, 2014, 03:14:36 PM
It worked! Thank you so much :D
Quote from: ron4mac on September 29, 2014, 12:33:05 AM
Sorry I couldn't get to this sooner ...

This interim patch for the issue you are experiencing is not official.

In the file searchnew.php at about line #106 change:
    $encoded_picfile = base64_encode($picfile);
to:
    $encoded_picfile = urlencode(base64_encode($picfile));

And in the file showthumb.php at about line #141 change:
$matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z\/\\\\_.-\s]+$/');
to: (add a tilde [~] after the lowercase z)
$matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z~\/\\\\_.-\s]+$/');


Anything official involving this would be pending whether ~'s are to be acceptably allowed in file names.
Title: Re: Can't upload pics with "~"
Post by: Αndré on October 06, 2014, 02:23:00 PM
Those changes have been committed in SVN revision 8741 and will be part of cpg1.5.32 and later.