[MAGNOLIA-2259] Handle special characters properly when checking links Created: 14/Jul/08  Updated: 23/Jan/13  Resolved: 22/Jan/09

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 3.6
Fix Version/s: 4.0

Type: Improvement Priority: Major
Reporter: Magnolia International Assignee: Jan Haderka
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File MAGNOLIA-2259-exception.txt    
Issue Links:
causality
is causing MAGNOLIA-3215 Encapsulate usage of JackRabbit speci... Closed
relation
is related to MGNLDMS-107 When title contains invalid character... Closed
is related to MAGNOLIA-2063 Files with Apostrophes in the Name Ca... Closed
is related to MAGNOLIA-2874 Check for existence of the path will ... Closed
supersession
is superseded by MAGNOLIA-2872 Further improve/consolidate Link api Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Followup to MAGNOLIA-2063 - indeed, we get the attached exception. This happens when we try to resolve the link, presumably because we don't escape the filename properly.
The actual upload and link work correctly though (because DefaultHierarchyManager.isExists()) hides the exception...)



 Comments   
Comment by Magnolia International [ 20/Jan/09 ]

Jan, can you check this with the 4.0 link improvements, then fix or bump to next version accordingly ?
(+testcase)

Comment by Jan Haderka [ 22/Jan/09 ]

Tried following 3 scenarios with special chars in image names:

  • create link to uploaded file via FCK (as described in MAGNOLIA-2063)
  • create link to uploaded image in DMS
  • create link to image uploaded directly via paragraph

In all cases it works just fine, and special chars in name (spaces, apostrophes, ...) were escaped with % notation as expected (in DMS case, special chars are replaced with _ as per MGNLDMS-107)
Will try to put together a test case to make sure it stays that way

If there are any more scenarios that you think should be tested, let me know

Comment by Magnolia International [ 22/Jan/09 ]

I still get the error.
Here's what I did:

  • Install a fresh up-to-date 4.0 snapshot
  • In the sample jsp page, add a new "HowTo jsp paragraph"
  • In the fck control of this new paragraph:
  • Hit the link button
  • Choose the upload tab
  • Upload a file with a single quote in its name (essai d'upload.png), click "send it to the server", acknowledge the "your file has been successfully uploaded" alert box.
  • Close the link dialog, acknowledge that the content of the fck control textbox has a link to something along the lines of /magnoliaAuthor/tmp/fckeditor/9f1f4c35-e87c-11dd-b82b-bbd46e98c248/essai d'upload.png
  • Save the dialog

The exception is logged every time the dialog is saved, but funnily enough, the link actually works and points to my image.

Comment by Jan Haderka [ 22/Jan/09 ]

Ha, I actually misunderstood what you were asking for. I was under impression it was not working before. Yes the exception was there. The reason for the exception is that when resolving links we first try to map path to the node, only when it doesn't exist we look if second last part of the URI exist as a node and whether it is a binary with property filename that matches the last part of the URI. This is exactly this case, so hm.isExist() returning false is absolutely correct, even tho it returns the value because parser fails to parse the path.

Comment by Jan Haderka [ 22/Jan/09 ]

Modified LinkFactory to check first whether path is valid before checking if it exists. r21605

Generated at Mon Feb 12 03:34:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.