-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[4.1] Media web service implementation #34314
Conversation
Co-authored-by: Richard Fath <[email protected]>
* [4.0] Changing title to tooltip fpr template preview
… pre-update check (#34227)
* [4.0] mod_popular with disabled hits When hits are disabled for articles it makes no sense to display the Most Read Articles module in the site or admin as the contents will never be updated. This PR changes the output of the module so that instead of a list of non-updating articles a message is displayed.
* Use MVCFactory to create models * CS
@alikon The error message is probably misleading. My guess is, it's caused by an invalid |
ouch i've omitted the filename from the body path....i'll retry.... |
I have tested this item ✅ successfully on 8466992 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34314. |
@alikon and/or @wilsonge I discovered a small issue with Media Manager's path settings in combination with a default |
as long as this pr it'only tested by me ... than better you'll complete in this pr |
Consider it done. |
As a result from the discussions in #34364, I believe some adjustments are necessary. The current implementation does not take multiple adapters into account. I'll ponder a bit on a possible solution and then get back. |
sure ... |
Update labels 2 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34314. |
@pjdevries can you please check pjdevries/joomla-cms#2 |
I'm very sorry, but like I mentioned before, I'm able to spend any time on this at the moment. |
As @pjdevries has no time to finish it, would you @alikon take over and create a new PR with this code + your fixes to Joomla! 4.1-dev branch? |
I can also take it over, as I can spend some time on it in the next week. |
Thanx @laoneo. I would appreciate that. |
thanks @laoneo please go ahead, i'll help with test |
Created a new pr #35788 which fixed most of the issue from @PhilETaylor. System tests are not yet finished and it also needs some more stabilization. I'm on holiday next week, so will not do much more in that time. |
closing in favor of #35788 |
Joomla-Mono-Vertical-logo-light-background-en.png.base64.txt
Vertical-logo-light-background-en.png.base64.txt
Pull Request for Issue #34224 .
Summary of Changes
My take on a media web service implementation. It relies on com_media's
ApiModel
to provide the logic. Two service models,MediumModel
andMediaModel
, provide wrappers aroundApiModel
to provide an interface as expected by the standard web service base classes.The service recognizes the following endpoints:
{path}
parameters in the above endpoints represent paths of existing files or folders, relative to the media base folder (images by default). They are used in single item requests instead of the usual numeric itemid
, since media items don't have id's.The web service mostly recognizes the same json request parameters as the com_media
ApiModel
. These are:path
: A file or folder path wherever appropriate. For instance, in case of thelist GET
request it points to the base folder, from which to retrieve the list of files and/or folders. Or the destination of a file or folder for aPOST
orPATCH
request.url
: Instructs com_media to include a separateurl
attribute in the resulting file objects. Has no effect on folder objects.temp
: Instructs com_media to include a separatetempUrl
attribute in the resulting file objects. I have no idea what the added value for this parameter is. Has no effect on folder objects.content
: Media content in base64 format forPOST
orPATCH
requests.In places where
path
is used, it can be prefixed withadapter:
to access files managed using that specific adapter. For eaxample:local-images:/banners/osmbanner1.png
,dpdropbox-Dropbox:/fo/bar/baz.jpg
, etc. If no adapter is specified,local-images
is assumed.These are issues I struggled with during the implementation:
LocalAdapter::createFolder()
ignores the result ofFile::create()
, so the sweb service has no clue if creating a new file or folder succeeded.LocalAdapter
sanitizes file names, so creating files or folders with questionable names (according to some) should not be a problem. However, the input PATH filter rejects questionable, but otherwise perfectly valid filenames (see [4.0] Why does the path filter not allow spaces in filenames? #34279).LocalAdapter
file/folder manipulation methods do not behave very consistently:createFile() and createFolder()
return a file or folder basename.move()
returns a path (directory + file-/foldername) with leading slash.updateFile(), moveFile() and moveFolder()
return nothing.ApiModel
in this case, are not handled properly by the default web service logic and result in 500 errors. I encountered similar behaviour before with other web services.Testing Instructions
Discover and enable the media web service plugin.
Obtain an active Joomla Api Token.
Run the following cURL commands, replacing the following and other, similar place markers:
Care must be taken that path names comply with the overeager input PATH filter.
The two attached base64 encoded files can be used to test
POST
andPATCH
requests.Documentation Changes Required
There is no documentation yet.