Issue
- If file entry validation is enabled and a web content article links to a Document Library file through an unencoded URL containing special characters (such as
'']})><\n|?""), publishing fails due to the inability to validate the URLs. The same failure occurs when saving web content whose HTML source links to a Document Library file with an unencoded delimiter character in its URL, such as a closing parenthesis
). The error is similar to this:Cannot validate the referenced document because it is not found with the following parameters: {groupId=[...], title=[...], folderId=[...], endPos=[...]}
Environment
- Liferay DXP 7.3+
Resolution
- You can resolve this in one of two ways:
- Encode the special characters in the link's URL in the web content's HTML source. For example, replace a closing parenthesis
)with%29. - Alternatively, turn off file entry validation. Liferay then publishes web content containing unencoded URLs without validating the links.
To turn off validation, navigate to Control Panel > Configuration > System Settings > Platform > Infrastructure > Import/Export and uncheck the Validate File Entries box.
- Encode the special characters in the link's URL in the web content's HTML source. For example, replace a closing parenthesis
Additional Information
- This failure is expected behavior. When you publish web content, Liferay validates links that point to the Document Library. It parses each URL and treats certain characters, called reference stop strings, as delimiters. Since an unencoded delimiter stops the parsing early, this validation runs on an incomplete URL and fails.