Documents & Media URL format changed in DXP 7.4 u36+
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- Document & Media Latest Version URL in DXP 7.4 u36+ has changed such that the groupid, folderId and UUID no longer is available from the URL.
- Previous upload URLs had a format of
/documents/groupid/folderid/documentTitle or /c/document_library/get_file?uuid=&groupid=
- New Document and Media Latest Version URLs in DXP 7.4 u36+ have a format of
/d/document_library/filetitle
Resolution
-
The URL format change was initially added in LPS-145475 but finally changed in DXP 7.4 u36 via LPS-156207. Unfortunately, the old URL format with the groupId, folderId or UUID would not be possible to bring back without customization.
-
To obtain metadata of a file (including UUID) after the change, the
FileEntryFriendlyURLResolver.resolveFriendlyURL(long groupId, String friendlyURL) API can be called, which will return an Optional containing the DLFileEntry object that has been stored in the database.
- The
friendlyURL paramater that should be passed into this API is the final segment of the returned (new format) URL. For example: if the Latest Version URL ishttp://localhost:8080/documents/d/guest/test-doc, then thefriendlyURLparameter would be/test-doc
-
UUID can be obtained by calling
dlFileEntry.getUUID()
-
groupId can be obtained by taking the second-to-last fragment of the returned URL (such as
/guestfrom the example above) and calling theGroupLocalService.getFriendlyURLGroup(long companyId, String friendlyURL) API.
- The
companyIdparameter could be obtained by callingCompanyThreadLocal.getCompanyId()
Did this article resolve your issue ?