Upload a user custom clip into dS Media Library.
dS Media Library has been extended with Create, Patch and Delete handlers.
Clip modifications are allowed only for the clips of USER category.
In order to upload clip and create a resource item in the dS Media Library,
we must first use the cgi-script upload-clip.hs
. It handles the actual clip file
upload and puts it into the staging area in the /tmp
directory.
As next we need to create a clip and provide the clip attributes.
The hanlder requires a clip name, category user, and exactly one resource,
where the uri points to the uploaded clip file in the tmp directory.
For security reasons we validate the base path of passed uri to make sure that
the handler will not modify the other system file or expose some sensitive
information.
When the requirements above are met, the handler will persist the clip attributes
and will move the clip from the staging area into the dS Media Library.
The user files are stored in subdirectory to allow easily distinguish them from
the preinstalled files that are not saved into backup.
We allow to update the clip name and the clip file. The new file should be uploaded
with the cgi script as well, then we should patch the clip uri with the path
to the new clip uploaded into tmp directory.