Feature RTC Unit/System Tests PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
26 May 2024

Pull Request for Issue # .

Summary of Changes

Trying to add /files folder, addittionaly to existing /images folder.
It is not very logical to have PDF (and other) documents under /images.

The changes affects new installations. Existing installations should continue to work as usual.

Testing Instructions

Check that Media manager works.
Upload images/files in Media manager view, upload images using Media field in Article editing, etc.

Actual result BEFORE applying this Pull Request

Works

Expected result AFTER applying this Pull Request

Works

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org: TBD
  • No documentation changes for manual.joomla.org needed
avatar Fedik Fedik - open - 26 May 2024
avatar Fedik Fedik - change - 26 May 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 May 2024
Category Administration com_admin com_media SQL Installation Postgresql Layout Front End Plugins
avatar Fedik Fedik - change - 26 May 2024
The description was changed
avatar Fedik Fedik - edited - 26 May 2024
avatar dgrammatiko
dgrammatiko - comment - 26 May 2024

@Fedik please add the files folder also here:

$localDirectories = (new Registry($local->params))->get('directories', [(object)['directory' => 'images']]);

avatar dgrammatiko
dgrammatiko - comment - 26 May 2024

FWIW I would prefer the folder to be named user_uploads than files

avatar Fedik Fedik - change - 26 May 2024
Labels Added: Feature PR-5.2-dev
avatar joomla-cms-bot joomla-cms-bot - change - 26 May 2024
Category Administration com_admin com_media SQL Installation Postgresql Layout Front End Plugins Administration com_admin com_media SQL Installation Postgresql Layout Libraries Front End Plugins
avatar Fedik
Fedik - comment - 26 May 2024

Added.

I think files is a good name, it also will produce a good links.
Let's say Company Site uploads a document, then link will be kind of example.com/files/foo-bar.pdf.
example.com/user_uploads/foo-bar.pdf will not looks "professional" ?

avatar Fedik
Fedik - comment - 26 May 2024

Currently there still a limitation (pretty huge), the custom field for Media does not allow to select anything else than folders under /images.
It is hardcoded

name="directory"
type="folderlist"
label="PLG_FIELDS_MEDIA_PARAMS_DIRECTORY_LABEL"
directory="images"

I think it will need another field to allow to pick folders from Media manager adapters, but that something for another PR.

avatar dgrammatiko
dgrammatiko - comment - 26 May 2024

Currently there still a limitation (pretty huge), the custom field for Media does not allow to select anything else than folders under /images

You're right, there's a @TODO for this:

<joomla-field-media class="field-media-wrapper" type="image" <?php // @TODO add this attribute to the field in order to use it for all media types ?>

avatar dgrammatiko
dgrammatiko - comment - 26 May 2024

One more thing, could you add an .htaccess file inside the files folder with content:

<Files *.php>
  deny from all
</Files>

Since this is a new folder we can restrict it to ONLY static files. (the same should be applied to images and media folders but that's irrelevant to this PR)

avatar Fedik
Fedik - comment - 26 May 2024

there's a TODO for this

Actualy, that "todo" can be already trashed, since we have type="images,documents", attribute.
What i meant, is media field configuration for Custom fields.

One more thing, could you add an .htaccess file inside the files folder

Hmhm, I can, but this can affect people who already have /files folder, and use it on its own purpuse.
Not sure here.

avatar richard67
richard67 - comment - 26 May 2024

It seems the system tests need to be adapted, too. Currently they fail at file api/com_media/Files.cy.js:

Test that media files API endpoint
    1) can deliver a list of files
    2) can deliver a list of files in a subfolder
    ✓ can deliver a list of files with an adapter (346ms)
    3) can search in filenames
    4) can deliver a single file
    5) can deliver a single file with the url
    6) can deliver a single folder
    7) can create a file without adapter
    8) can create a folder without adapter
    9) can create a file with adapter
    10) can create a folder with adapter
    11) can update a file without adapter
    12) can update a folder without adapter
    13) can update a file with adapter
    14) can update a folder with adapter
    15) can delete a file without adapter
    16) can delete a folder without adapter
    ✓ can delete a file with adapter (325ms)
    ✓ can delete a folder with adapter (315ms)

  3 passing (38s)
  16 failing
avatar Fedik
Fedik - comment - 26 May 2024

It seems the system tests need to be adapted, too

Yeap, I will look on it later

avatar brianteeman
brianteeman - comment - 26 May 2024

image

avatar Fedik
Fedik - comment - 26 May 2024
1350604 29 May 2024 avatar Fedik test
avatar joomla-cms-bot joomla-cms-bot - change - 29 May 2024
Category Administration com_admin com_media SQL Installation Postgresql Layout Front End Plugins Libraries Administration com_admin com_media SQL Installation Postgresql Layout Libraries Front End Plugins JavaScript Unit Tests
c8e02f3 29 May 2024 avatar Fedik test
avatar Fedik Fedik - change - 29 May 2024
Labels Added: Unit/System Tests
fe7e10c 29 May 2024 avatar Fedik test
4a46eec 29 May 2024 avatar Fedik test
d58dd1a 29 May 2024 avatar Fedik test
6eb991b 29 May 2024 avatar Fedik test
c324611 29 May 2024 avatar Fedik test
6ee3fa0 29 May 2024 avatar Fedik test
e2e6cf4 29 May 2024 avatar Fedik test
avatar laoneo
laoneo - comment - 30 May 2024

I really like it, just the name is for me too generic. I would rather go with documents, if you name them files, then should the images also be moved there. Or you can go with /files/images and /files/documents. But having a generic files in root which directly contains everything except images is for me not logical.

avatar Fedik
Fedik - comment - 30 May 2024

I will keep it generic.
We definitely can do /files/images, sometime in future. 1 step at time :)

avatar Fedik
Fedik - comment - 30 May 2024

I found a bug in media manager API, it always return path without adapter

And when you doing API call with non default adapter,
like rename folder local-potato:/folder to local-potato:/folder-new it produces 404 error.
Because it looking in default adapter local-files:/folder-new instead of requested local-potato:/folder-new.

avatar brianteeman
brianteeman - comment - 30 May 2024

I am a bit confused about the need for this PR.

If I create a folder myself in the root of the web space then I can already achieve everything that this PR does - what am i missing?

avatar Fedik
Fedik - comment - 30 May 2024

what am i missing?

You need to create the folder by yourself. That what you missing ?
I offer to have it in the core by default, so you do not have to create it by yourself every time.

avatar brianteeman
brianteeman - comment - 30 May 2024

what am i missing?

You need to create the folder by yourself. That what you missing ? I offer to have it in the core by default, so you do not have to create it by yourself every time.

Then I dont see the point in adding this

avatar Fedik
Fedik - comment - 30 May 2024

I do not know, man. I do not know what to say.
It is absolutely basic thing that should be done a decades ago.

Look, we have allowed uploads bmp,gif,jpg,jpeg,png,webp,avif,ico, mp3,m4a,mp4a,ogg, mp4,mp4v,mpeg,mov, odg,odp,ods,odt,pdf, png,ppt,txt,xcf,xls,csv
And by default all goes in to /images folder, it confuses newcomer very much.

There still limitation that need to address, like hardcoded /images path in many places, but that for the future.

avatar brianteeman
brianteeman - comment - 30 May 2024

It is absolutely basic thing that should be done a decades ago.

It was and we removed it

avatar sousa9g
sousa9g - comment - 31 May 2024

From a Joomla extension developer view, this change is much needed. It is helpful not only for the core com_media. Thank you for adding it.

avatar MacJoom MacJoom - test_item - 15 Jul 2024 - Tested successfully
avatar KingLouis1 KingLouis1 - test_item - 15 Jul 2024 - Tested successfully
avatar MacJoom
MacJoom - comment - 15 Jul 2024

I have tested this item ✅ successfully on 2c7e0af

Tested on 5.2 Alpha 2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43532.

avatar KingLouis1
KingLouis1 - comment - 15 Jul 2024

I have tested this item ✅ successfully on 2c7e0af


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43532.

avatar richard67
richard67 - comment - 15 Jul 2024

@MacJoom This pull request has a conflicting file, so I can't set it to RTC.

avatar MacJoom MacJoom - alter_testresult - 15 Jul 2024 - MacJoom: Not tested
avatar MacJoom
MacJoom - comment - 15 Jul 2024

@MacJoom This pull request has a conflicting file, so I can't set it to RTC.

Yeah just noticed, set back to untested

avatar peterpeter peterpeter - test_item - 15 Jul 2024 - Tested successfully
avatar peterpeter
peterpeter - comment - 15 Jul 2024

I have tested this item ✅ successfully on 2c7e0af


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43532.

avatar richard67
richard67 - comment - 15 Jul 2024

@Fedik Could you fix the conflict in the integration test file? When that is done this PR can be set to RTC. Human test are valid as the conflict is only in that file which does not have effect on the tested functionality.

avatar crimle crimle - test_item - 15 Jul 2024 - Tested successfully
avatar crimle
crimle - comment - 15 Jul 2024

I have tested this item ✅ successfully on 2c7e0af


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43532.

avatar Fedik
Fedik - comment - 15 Jul 2024

synced

avatar richard67 richard67 - alter_testresult - 15 Jul 2024 - crimle: Tested successfully
avatar richard67 richard67 - alter_testresult - 15 Jul 2024 - peterpeter: Tested successfully
avatar richard67 richard67 - alter_testresult - 15 Jul 2024 - KingLouis1: Tested successfully
avatar richard67 richard67 - alter_testresult - 15 Jul 2024 - MacJoom: Tested successfully
avatar richard67 richard67 - change - 15 Jul 2024
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 15 Jul 2024

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43532.

avatar Quy Quy - change - 16 Jul 2024
Labels Added: RTC
avatar laoneo
laoneo - comment - 16 Aug 2024

Please do not merge till there is an agreement in production about our future folder strategy.

avatar Hackwar
Hackwar - comment - 29 Aug 2024

There still is no agreement in production about this feature. Since we had a feature freeze, I'm moving this to 5.3.

avatar Hackwar Hackwar - change - 29 Aug 2024
Title
[5.2] Add Files folder to Media component and to "FileSystem local" adapter
[5.3] Add Files folder to Media component and to "FileSystem local" adapter
avatar Hackwar Hackwar - edited - 29 Aug 2024

Add a Comment

Login with GitHub to post a comment