Affects Version/s: 7.3.X, Master
Component/s: Staging > Export/Import
The DLReferencesExportImportContentProcessor class detects and updates URLs for Documents & Media during the export/import process, modifying them so that they point to the Document on the Import (or Live) site rather than the Document on the Export (or Staging) site. During the import process, it grabs the preview URL by calling the DLURLHelper#getPreviewURL method, which always returns a URL with a "t" (timestamp) parameter appended to it. To make up for this, during the export process, it removes the "t" parameter (assuming there was one) from the export URL, so that it can be re-replaced when creating the import URL.
This means, that if the original export URL did not include a "t" parameter, the DLReferencesExportImportContentProcessor will add one anyway during the import process.
This is not the desired behavior. If the export URL does not contain a "t" parameter, then it was likely an intentional design decision by the admin, indicating that the admin wanted to ensure that their users always download the latest version of the file. By appending a "t" parameter, we are changing the behavior of that URL, such that the functionality of the URL on the export site is different than that of the import site. The URL of the export site (which doesn't have the "t" parameter) will always download the latest version of the file, whereas the URL of the import site (which does have the "t" parameter) will always download one specific version of the file.
We should fix this behavior by (1) Not removing the "t" parameter during the export process and (2) Removing the "t" parameter from the computed URL during the import process. This will ensure that the import URL stays equivalent to the export URL - by the time it is all said and done, the "t" parameter will remain untouched, ensuring that whatever value it had (if any) will be retained after the process is complete.
Steps to Reproduce
1. Navigate to Publishing > Staging.
2. Enable Local Live Staging for Documents and Media and Web Content.
3. Navigate to Content & Data > Documents and Media.
4. Upload a document.
5. Click on the tri-dot menu of the document you just uploaded.
6. Right click on "Download" and copy the URL.
7. Navigate to Content & Data > Web Content.
8. Create a Web Content.
9. Give the Web Content any title. Inside of the "content" field, paste the download URL that you copied in step 6. Remove the link so that only the text of the URL remains. Remove the "t=xxxxxxxxxxxxx&" param from the URL (i.e. so that it looks like "http://localhost:8080/documents/40140/0/test.png/6e0269f9-4578-1942-bc0b-65d2e68e35cc?download=true" as opposed to "http://localhost:8080/documents/40140/0/test.png/6e0269f9-4578-1942-bc0b-65d2e68e35cc?t=1623450745317&download=true") .
10. Add a Web Content Display portlet to the Home page.
11. Configure the Web Content Display portlet to display the Web Content you created in Step 9.
12. Navigate to Publishing > Staging.
13. Publish your changes.
14. Navigate to the Home page on the Live site.
15. View the content inside the Web Content Display portlet.
Expected Result: The content would have the exact same URL as on staging, except that the Site ID portion of the URL would've been changed to point to the Live Site.
Actual Result: The URL in the content has a "t=xxxxxxxxxxxxx" parameter in it that wasn't there before. This means that the URL is now pointing to a specific version of the file, rather than the latest version of the file.