Uploaded image for project: 'Magnolia Standard Templating Kit (closed)'
  1. Magnolia Standard Templating Kit (closed)
  2. MGNLSTK-1214

stkTemplatingFunctions.getAssetLink() not consistently encoded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Neutral Neutral
    • None
    • 2.0.10
    • None
    • Magnolia 4.5.9
    • Yes

      stkTemplatingFunctions.getAssetLink(Node content, String nodeDataPrefix) returns an encoded url when the data has been "selected from the DMS" via the dialog.

      However, it returns a non-encoded url when the data has been "uploaded" via the dialog.

      Solution:
      Encode the URL when it has been "uploaded" via the dialog. See example below:

      String nonEncodedUrlStringForAsset = "//localhost:8080/url/to/non/encoded/doc/my doc.pdf";
      URI uri = new URI("http", nonEncodedUrlStringForAsset, null);
      URL url = uri.toURL();

        Acceptance criteria

              rsiska Robert Šiška
              adrien_be Adrien Berthou
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: