Fieldtype, Module

Archived
Forum
(read-only)

Protected Links

ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6

Back to this add-on's main page
View Other Add-ons From Yuri Salimovskiy

     

S3 zip and cpgz file

Support Request

drudoran
drudoran
Yuri Salimovskiy
# 1
Developer
Yuri Salimovskiy

So what’s the question? :)

Yuri Salimovskiy
# 2
Developer
Yuri Salimovskiy

So what’s the question? :)

drudoran
# 3
drudoran

Sorry - don’t know what happened there…

I have some zip files on S3. When I download them from a normal <a > link on my site, they download and unzip fine.

When I use the Protected Links, the file downloads ok, but when I unzip them, they contain cpgz files.

Any idea whats happening there?

Andy

Yuri Salimovskiy
# 4
Developer
Yuri Salimovskiy

My only guess is that it’s something happening on S3 side.., maybe some setting or what
Because Protected Links is simply retrieving the file and passing it to customer, it does not make any changes

drudoran
# 5
drudoran

It’s strange - Been using Protected Links for about a year with no problems, then yesterday I upgraded EE to 2.4.0 and also upgraded Protected Links and I just can’t get it working again.

I have taken out the index.php and have the htaccess set up as instructed on Expression Engine, so don’t know if this would cause an issue.

But I’ve just tested a very basic page with this tag:

{exp:protected_links:generate url=“http://www.mydomain.com/files/test.zip” ip_lock=“yes” guest_access=“yes” title=“Get the file!”}

and the file starts to download, but only about 1k. When I open the download in text mate, I can see the following message:

A PHP Error was encountered

Severity: Warning
Message:  curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
Filename: protected_links/mod.protected_links.php
Line Number: 212

Does that suggest anything ?

Regards

Andy

 

Yuri Salimovskiy
# 6
Developer
Yuri Salimovskiy

Hi Andy,

such error usually happens when there’s some sort of redirect in .htaccess (for example, forcing all requests to non-www domain to www domain or vice versa)
Try disabling such rule for the directory where you have the files, or make sure you use the domain that does not involve redirection

drudoran
# 7
drudoran

Thanks Yuri - if it helps anyone with similar issue - here is the answer…

In the Expression Engine docs, it says to remove the index.php from your site, place this in your htaccess…

<IfModule mod_rewrite.c>
        
RewriteEngine On

        
# Removes index.php
        
RewriteCond $!\.(gif|jpe?g|png)$ [NC]
        RewriteCond 
%{REQUEST_FILENAME} !-f
        RewriteCond 
%{REQUEST_FILENAME} !-d
        RewriteRule 
^(.*)$ /index.php/$1 [L]

        
# If 404s, "No Input File" or every URL returns the same thing
        # make it /index.php?/$1 above (add the question mark)
</IfModule

 

I just added zip to the file extensions on line 5 as follows

RewriteCond $!\.(gif|jpe?g|png|zip)$ [NC] 

Now everything’s working fine and zips don’t contain cpgz files anymore

Thanks again for a great module.

Andy

Yuri Salimovskiy
# 8
Developer
Yuri Salimovskiy

That’s important to know - thanks for sharing!