Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#33687] Fix: Cannot upload file to sub-folder in Media Manager #3551

Closed
wants to merge 1 commit into from
Closed

[#33687] Fix: Cannot upload file to sub-folder in Media Manager #3551

wants to merge 1 commit into from

Conversation

@zero-24 zero-24 changed the title Fix: Cannot upload file to sub-folder in Media Manager [#33687] Fix: Cannot upload file to sub-folder in Media Manager May 2, 2014
@wilsonge
Copy link
Contributor

wilsonge commented May 2, 2014

As I can't access the trackers (usual broken stuff) nor read german (should have paid more attention at school) how do I replicate this?

@sovainfo
Copy link
Contributor

sovainfo commented May 3, 2014

See #32032 in the Feature tracker, not broken anymore!
You may blame the J!Tracker Application for transmitting this comment.

@sovainfo
Copy link
Contributor

sovainfo commented May 3, 2014

Just try uploading anything to a folder.

You may blame the J!Tracker Application for transmitting this comment.

@zero-24
Copy link
Contributor Author

zero-24 commented May 3, 2014

@wilsonge
There are different reports that uploading to a sub folder (e.g. images/sampledata/parks) upload the image to the /images folder.

So you can do the following:

  1. login to the backend
  2. access the media manager
  3. navigate to a sub folder
  4. try uploading a image
  5. apply patch
  6. test again

Thanks.

@sovainfo
Copy link
Contributor

sovainfo commented May 3, 2014

#test Confirm issue and resolution.
Folder is now created at the expected location, image is uploaded to current folder.
You may blame the J!Tracker Application for transmitting this comment.

@sovainfo
Copy link
Contributor

sovainfo commented May 3, 2014

For consistency would suggest '$this->input->post->get(' instead of '$this->input->get->get('
You may blame the J!Tracker Application for transmitting this comment.

@Bakual
Copy link
Contributor

Bakual commented May 3, 2014

For consistency would suggest '$this->input->post->get(' instead of '$this->input->get->get('

This depends if the folder is given in the URL (GET request) or is coming from the form data (POST) imho. The proposed code looks specifially in the URL while your suggestion would look in the form data.

@sovainfo
Copy link
Contributor

sovainfo commented May 4, 2014

Not my line of expertise. Find it strange, both fields (return-url and folder) are hidden fields, one is taken from post, the other from get. Makes me wonder, especially when something doesn't work as expected.

@ghost
Copy link

ghost commented May 5, 2014

@test
The patch worksforme. Image is now loaded in selected folder

@peterlose
Copy link
Contributor

Test. The PR fixes the problem!

@Bakual
Copy link
Contributor

Bakual commented May 5, 2014

@sovainfo has a valid point. There is a hidden folder field in the form, but it's not populated with a value. That's the main reason why the current code fails.
The script gets two inputs, one from GET (with the correct value) and one from POST (with an empty value), and the POST one overrides the one from GET.
While this fix works, I would actually prefer it if the form field would properly updated with the correct value. Or just remove the hidden field if we pass the folder in the request anyway (which I think isn't good).
It takes the value from $this->state->folder, see https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_media/views/media/tmpl/default.php#L64 and it looks like this state isn't properly updated when traversing directories.

There are also other places where this state is used, so I gess we may well have other bugs with that.

@ghost
Copy link

ghost commented May 6, 2014

The patch for File uploads works indeed. However the issue is also applicable for creating subfolders in the media manager. If you create a subdirectory it is placed in the root (I tested that) and not in the directory where you created the sub. I guess Thomas this is one of those places where it indeed bugs as well with that

@sovainfo
Copy link
Contributor

sovainfo commented May 6, 2014

Weird, as reported, creating subfolders worked in my environment.

@n9iels
Copy link
Contributor

n9iels commented May 6, 2014

creating sub folders works only fore me when I upload a file. Like I described in the tracker item: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33413 at 2014-05-05 23:08:58

@ghost
Copy link

ghost commented May 6, 2014

Exactly the behavior I also experienced that's why I posted. I think
that is because of the double "get" as described by Thomas
On 5/6/2014 4:22 PM, n9iels wrote:

creating sub folders works only fore me when I upload a file. Like i
described in the tracker item:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33413


Reply to this email directly or view it on GitHub
#3551 (comment).

@ghost
Copy link

ghost commented May 7, 2014

Here's another a fix or Re:Later for "If you create a subdirectory it is placed in the root (I tested that) and not in the directory where you created the sub".

  1. a CSS class is missing to show the parent folder in grey uneditable INPUT (/administrator/components/com_media/views/media/tmpl/default.php)
  2. a JQuery error in /media/media/js/mediamanager.js. value is assigned to the index of an INPUT-element in a collection instead to the INPUT-element (JQuery object) itself.

We've tested all three fixes with J!3.2.4 and 3.3.0

Why ...get->get...? Because "folder=..." is added to the action URL by JavaScript, that's transmitted by GET..

http://www.joomlaportal.de/joomla-3-x-installation/309865-sammelthread-joomla-3-3-0-released-5.html#post1535107

@Bakual
Copy link
Contributor

Bakual commented May 7, 2014

Why ...get->get...? Because "folder=..." is added to the action URL by JavaScript, that's transmitted by GET..

The thing is that the current JInput->get('folder') would actually work fine if the empty hidden folder field wasn't present in the form. We don't really need JInput->get->get('folder').
There are two ways to properly fix this:

  • Remove the hidden folder field.
  • Fix the hidden folder field and remove the folder parameter from the URL (as it's not needed anymore).

@sovainfo
Copy link
Contributor

sovainfo commented May 7, 2014

Was able to create subfolders multiple levels deep. Also in other folders. Changed the statement into post and back to original. Made no difference, it kept working!

So, I recreated a j33demo environment. Verified existance of the bug, it exists. Added ->get, could upload image. Could also create subfolder, but only after uploading image.

Didn't test suggestion of ilovo brcause I don't like the folder in the url. Would like to have it in the post!

@ghost
Copy link

ghost commented May 8, 2014

Thomas,
If what you write is the best option than please implement so we can test this and get over it? I also do not like illovo's suggestion because of the url and I have same experience in testing at present as Sovainfo has so let's follow Thomas suggestion ?

@Bakual
Copy link
Contributor

Bakual commented May 8, 2014

Please test #3575
Looks like the fix in the forum thread mentioned by @illovo is indeed the correct one.

@Bakual
Copy link
Contributor

Bakual commented May 8, 2014

Fixed with PR #3575
Thanks all!

@Bakual Bakual closed this May 8, 2014
@zero-24 zero-24 deleted the patch-21 branch May 11, 2014 13:15
@Wequips
Copy link

Wequips commented Jul 3, 2015

Could anyone explain to me what a patch is. I'm struggling with the same issue as you all do. The Media Manager. The final step is: apply patch. But I don't know how to do that...

@sovainfo
Copy link
Contributor

sovainfo commented Jul 3, 2015

Sounds like you need to apply #3575 using com_patchtester.

@Wequips
Copy link

Wequips commented Jul 3, 2015

Thanks for messaging!
And this sounds already difficult for me...

@Bakual
Copy link
Contributor

Bakual commented Jul 3, 2015

This issue is resolved. Updating to the lastest version of Joomla should fix this.

If not, please open a new issue so it can get fixed.

@Wequips
Copy link

Wequips commented Jul 3, 2015

I have this version: Joomla! 3.4.1

Two weeks ago I was able to make a sub-folder, but now I can't anymore...

@wilsonge
Copy link
Contributor

wilsonge commented Jul 3, 2015

Then you should update to 3.4.3 - which got released yesterday!

@Wequips
Copy link

Wequips commented Jul 3, 2015

OK, I see. Solved. Thaks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants