Welcome, Guest
Username: Password: Remember me

TOPIC: Downloads no longer working

Downloads no longer working 03 Dec 2013 22:44 #11733

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Hello,

I updated some minor items in my component. In J-Cook v2.6 downloading items worked. In v2.6.2 they no longer work.

This component generates files and not uploads them. Regardless, it still does this correctly. The file shows up in the directory defined in options. However, none of the download links work. A new browser tab opens (just as before) and then nothing. No error logs either. Just nothing. Previously the file would download. Also, when I delete the entry on the backend it does not remove the file. Previously it did remove the file. (v2.6)

I uploaded my v2.6 saved component with the exact same edits in the v2.6.2 component. It works great.


Ideas?
--
Jerry Benton
The administrator has disabled public write access.

Downloads no longer working 03 Dec 2013 23:46 #11734

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Ok I have been screwing around with this for HOURS trying to figure out what the hell the problem is. I have no clue. What I do know is this:

- Downloads do not work
- Deleting an item does not delete the file (when it should)

My best guess is this function in helper.php is screwed up.
public static function getDirectories()


This seems to be new since v2.6.1 and I cannot believe no one has figured downloads do not work since v2.6.
--
Jerry Benton
Last Edit: 03 Dec 2013 23:47 by jcbenton.
The administrator has disabled public write access.

Downloads no longer working 04 Dec 2013 00:07 #11735

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
One last thing that I noticed that is missing in the download URL in v2.6.2:

action=download


This was in v2.6 and is still in the code in v2.6.2 but is not getting added. I tried to manually create a link and download the file but it did not work.
--
Jerry Benton
The administrator has disabled public write access.

Downloads no longer working 04 Dec 2013 20:55 #11739

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
So I created a brand new component to test the file downloads. This does work, but I noticed something very different. Previously I had user's files outside of the web root so the whole world cannot download everyone else's files.

Example:

Web root: /home/user/public
Files: /home/user/webfiles

When I add the full path to the options, the component does this:

/home/user/public/home/user/webfiles


WTF?
--
Jerry Benton
The administrator has disabled public write access.

Downloads no longer working 05 Dec 2013 19:29 #11746

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
I found the item screwing up the path for file downloads:
	public static function getPhysical($path, $options = null)
	{
		if ($options)
			$path = self::getThumbName($path, $options);

		//return JPATH_ROOT .DS. self::getDirectory($path);
		return self::getDirectory($path);
	}
--
Jerry Benton
The administrator has disabled public write access.

Downloads no longer working 06 Dec 2013 17:12 #11755

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Yes sorry, I had the head under the water recently.

Actually the access to the files have been rewrited and I am gonna do a tutorial for this.

The download task ? yes. Ok I am gonna fix that. (moved to new tickets)

Now JDom always make its queries through the component main HELPER when it ask for component special informations such as full path.
Now your component can manage really easier the accesses.

It is great and innovative feature of cook to access all files. Even through ACL using database mode.
I feel bit responsable every time when I cannot be answering the forum.
You can honestly put me a karma down lol... It works also for that.
Coding is now a piece of cake
The administrator has disabled public write access.

Downloads no longer working 16 Feb 2014 14:06 #12203

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
You cannot do this fix.

The JPATH_ROOT is very important.

Have a look in the docs :
www.j-cook.pro/index.php/f/files

Try also the sample component called "Files accesses"
www.j-cook.pro/index.php/docs/samples
Coding is now a piece of cake
The administrator has disabled public write access.

Downloads no longer working 16 Feb 2014 14:14 #12204

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
I already fixed this long ago in my component. The default jcook code locks you into the JPATH_ROOT and does not allow you to store critical files outside of the web directory. For example:

/home/user/public_html

/home/user/sensitive_files

If the function is locked to the JPATH_ROOT and this happens to be the public_html directory, there is no way you can store files in the sensitive_files directory.

In my opinion you were better off leaving it as it was before, which allowed the user to specify the exact directory on the server. The current model does not let you do that.

You can see this in action on www.mailborder.com if you like. I use it to manage my user's licenses.
--
Jerry Benton
The administrator has disabled public write access.

Downloads no longer working 16 Feb 2014 15:04 #12208

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
You are right.
I will try to improve it.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.161 seconds

Get Started