Hi Brad,
I’m having a strange issue with this module, where it seems to be generating the link with characters like / and . in it, like this:
http://www.domain.com/?ACT=45&url=1&linklocker=MLpNnTx5t0I5eREx.pRWN1Oj7z0DrBI07ozyTZAnM1/dyz2021EM3.R0aF4iMtMlEwmWr3=0f2c=N2.vAf5Smh0BmCAm.d0ALQIFhTfRqNavGgTe42xglHzIuiEfwN3tolih.vn43bHF3YO0JLC2CkjUBJYEk1kGwYm0tMZ.8MwvJ/9=H0xB=hYKwAVlhlh3gC.AP/S1Ar49LhgnTqM7tdgQbFmT=60qM=n3.3Az69wh17oXA7.UJA4oX2hf.9ga9.QvHCwj0Ramuu08frCcO0/5D8C6/obQlWv0/p4L2hTs2Jw/7V5A8jl.ATSL1586m/H42N4FIMvBYbybRMX7X610KBcBETs.a2mZ4qDLXobiLRBV.Kl1CjUboHwmHKFzDl/g4Foc4X2dTDICWf39F14G/Zh7QwdbP0y5i51SP59j11j8twhbEK812FZcE03FwWukK4tYg804XRJeWUB3o5vy0TfZ//Dvmg4RBlmR79sj0/DZ36YKX5p2bMex.uvC33OZv4syWWS0cxM3Y8l1Iyqcd4cG3be66N162HvXJn5bE46fnrCRnMa0TCvDMM1UIy4723o6/VhE86st51xZSq9LlI5/u9Blg8BiGK0Y9jgj2VpsJNirZOl.wY5cxv66HF4rrR6Py9h9nx7bbXwJm8zUQNA0k9lYHq5XtMDr26QH.F41i1u7DQbZHZJLF15JV9w723T5M2PZABFNWP.vwxzX6Km.nK.XQ8pI03F09x6mHtv762pdvVU5m3owWULCfaucdLlc/5l0GbqhORvL3AmF9XXA6Z7.hyu0ZA9BY9A1u2fh0029MAp.FA.3jD=Ltpz=f8NyAOTEqh00Q0A0yxsA/SLehfpV5A2pcbhS0XsA3QcxA6SS5h//.4
The forward slashes cause EE to parse the URL into segments, and because there is so many of them (more than 10), it errors out, saying “The URL contains too many segments” (in /system/core/core.input.php - line 282).
Can you think of any reason why it would be doing that? Could it be a server thing? I’m running on PHP 5.2.4, EE 1.6.4…
Hey Michael,
Wow - that is weird. Have you tried passing in a hard coded link, such as http://www.mysite.com/files/mylink.txt? My first suspicion would be that the link is being passed in dynamically, and perhaps the field that holds the link isn’t in “text only” format - but that’s just a stab in the dark.
Just as a quick note I had the same problem too with an error coming up saying too many segments and this was (I’m pretty sure it was anyway) due to me using the great File extension by Mark Huot and the fact that it stores the entire web address to the file. Not usually a problem but in this case the slashes were getting added into the URL and so causing the problem.
A simple workaround was that I just used the excellent Extract URL Plus 2 plugin to enable me to just use the filename and extension in with Linklocker and it got rid of all the problems straight away.
Don’t know if that helps anyone at all though just thought I would mention it in case anyone has the same problem.
Best wishes,
Mark
Mark, I thought that Link Locker required the full url to the file, not just the path or filename?
You know you are absolutely correct on that one and taking a look back at my code I have absolutely no idea why it is working!! 😉
I used this in the end :
<a href="http://{exp:linklocker" title="Download - {title}">Download - {title}</a>
This is allowing the files to all download without any problems and if I use just this on the page :
{exp:zm_extract_url_plus url='{downloads-file}'}{file_name}{/exp:zm_extract_url_plus}'}
I see that it just spits out the file name. All very very weird as my files are stored in :
http://www.example.com/images/site/downloads/
so with me just passing in the file name I’m not really too sure how linklocker is managing to download them. There must be something weird going on that I’m not seeing but I just don’t know what at the moment, sufficed to say though it is downloading files which is really weird!
Best wishes,
Mark
Okay just did another test and placed this code :
< a href="{exp:zm_extract_url_plus url="{ downloads-file }"}{ file_name }{/exp:zm_extract_url_plus}">Download - {title}</ a>
Had to place spaces into the above code as it wouldn’t post otherwise
into the same template and I can see that indeed the wrong link comes out - http://www.example.com/filename.jpg instead of it should be http://www.example.com/images/site/downloads/filename.jpg but for some reason the linklocker links all work fine!! Really really weird and I’m not too sure what is happening or how it is managing to download the files correctly to be honest.
Sorry for perhaps running people down an incorrect path but I really would like to know how linklocker is managing to download the files when from what I can see I’m not actually supplying it with a valid link!!
Brad, any ideas mate!
Best wishes,
Mark
I don’t know if it’s just too early in the morning or what, but I’m at a loss here. I should start by saying I’m not familiar with the zm_extract_url_plus plugin, so I can’t really speak to that. I can, however, say with 100% confidence that the LinkLocker plugin will not work unless provided with a correct complete URL to the file that is to be encrypted.
Mark, I’m not sure why it works when it appears that you are passing it only a file name, but I can say with complete certainty that when all is said & done it is being passed a complete URL. There is no code in the module to set any sort of defaults for any portion of a URI.
I would suggest for Michael that he try the following steps: Step 1: Type the complete URI (http://www.whatever.com/files/file.zip) into your web browser and make sure that you can download the file. This will ensure that .htaccess isn’t blocking the download of the file.
Step 2: Once you have verified that you can download the file when the “naked” link is placed in a browser’s address bar, try passing the hard coded value to the LinkLocker module without wrapping it in any other expression tags. Verify that you can click on the link that LinkLocker generates and download the file.
Step 3: If this works, take a look at any other modules you may be using in conjunction with LinkLocker - perhaps modules that are retreiving the URL from the database. Make sure that the fields that hold the links are “text only” so that they aren’t adding any sort of markup like “” tags to the link.
I don’t know if it’s just too early in the morning or what, but I’m at a loss here. I should start by saying I’m not familiar with the zm_extract_url_plus plugin, so I can’t really speak to that. I can, however, say with 100% confidence that the LinkLocker plugin will not work unless provided with a correct complete URL to the file that is to be encrypted. Mark, I’m not sure why it works when it appears that you are passing it only a file name, but I can say with complete certainty that when all is said & done it is being passed a complete URL. There is no code in the module to set any sort of defaults for any portion of a URI.
I totally hear you there Brad! I thought it was really early too!!! 😉
I truly can’t see how it is getting the full URL myself although I know that it does have to have it and there’s no way that Linklocker would be able to ‘guess’ the rest of the link. Truly truly weird!!
The reason I used the Extract URL Plus 2 plugin was to get rid of all the slashes (/) appearing in the link that is created so that ExpressionEngine doesn’t complain. I have absolutely no idea what made me just get the filename and then not put the rest of the URL to the file in front of it, I think I must have been tired at the time! It still doesn’t explain what is going on which really is making me think how is this working now! 😊
Is there any way I can get Linklocker to not apply the coding so that I can see exactly what link it is being supplied with. I would really love to figure out how this is working in the way I have it at the moment just for my own peace of mind!! 😊 😉 😊
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.