Allow shorty UUIds in user urls
We have a lot of tooling that spits out files/json/xml when a user passes a whole long nasty uuid, things like:
- http://demo.dotcms.com/contentAsset/image/b8a5ce78-314a-4dc7-b1a6-9ab3ae9f6893/image/byInode/1
- http://demo.dotcms.com/dotAsset/4d7daefa-6adb-4b76-896d-c2d9f95b2280.jpg
- http://demo.dotcms.com/api/content/id/4d7daefa-6adb-4b76-896d-c2d9f95b2280
It would be great if we could instead pass the first 8 digits of the uuid and still get the results we wanted, e.g.
- http://demo.dotcms.com/contentAsset/image/b8a5ce78/image/byInode/1
- http://demo.dotcms.com/dotAsset/4d7daefa.jpg
- http://demo.dotcms.com/api/content/id/4d7daefa
These are much more user friendly urls. Additionally, a user should not have to specify if a uuid is an inode or an identifier. We have that data in the system and should do that work for the user.
Expected Behavior
Have uuid based URLs work using the first 8 chars of the uuid
Current Behavior
does not work
Possible Solution
Impl a ShortyAPI w/ cache that will take the 8 chars and return the whole 36 char uuid that it represents.
I think all our image and file pathing should use this type of pattern.
This is the type of dev that happens on long plane rides....
+1 Image filter pathing would be much simpler without having to specify /byInode/1 (or having to know whether or not you need it).
Added a dA servlet (dotAsset) which does the following:
http://127.0.0.1:8080/contentAsset/image/b8a5ce78-314a-4dc7-b1a6-9ab3ae9f6893/image/byInode/1 becomes http://127.0.0.1:8080/dA/b8a5ce78
By Inode
http://localhost:8080/contentAsset/image/249eeb5c-7002-48e8-9ef3-ea6cd8ea9043/fileAsset/byInode/1/filter/Resize/resize_w/300 becomes http://localhost:8080/contentAsset/image/249eeb5c/fileAsset/filter/Resize/resize_w/300 or http://127.0.0.1:8080/dA/249eeb5c
By Id
http://localhost:8080/contentAsset/raw-data/4d7daefa-6adb-4b76-896d-c2d9f95b2280 becomes http://127.0.0.1:8080/dA/4d7daefa
dA will serve the first binary field on any content type if not specified
http://127.0.0.1:8080/contentAsset/resize-image/5d021a67-dafa-4244-be12-a3afdc956dd6/image/ becomes http://127.0.0.1:8080/dA/5d021a67
Can you add filters to the end of the /dA notation (e.g. http://127.0.0.1:8080/dA/5d021a67/filter/Resize/resize_w/300)?
Not yet, but I was thinking it would be a great addition. In fact, we could infer the filters based on their arguments, e.g.
http://127.0.0.1:8080/dA/5d021a67/resize_w/300 http://127.0.0.1:8080/dA/5d021a67/filter/Resize/resize_w/300
PR: https://github.com/dotCMS/core/pull/9844
Merge into master-3.7: https://github.com/dotCMS/core/pull/10422