Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking error #17272

Closed
Jrod72 opened this issue Oct 14, 2024 · 18 comments
Closed

Linking error #17272

Jrod72 opened this issue Oct 14, 2024 · 18 comments

Comments

@Jrod72
Copy link

Jrod72 commented Oct 14, 2024

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

14.3.0

Bug summary

We are about to move to Umbraco Cloud from Umbraco 7.xxx. We have not yet deployed the site as we are have problems with links either to pdf documents or to other pages on the site when previewing. External links seems to work. Trying to re-link doesn't help. Either there is a "page not found" result or nothing happens.

Specifics

Example of a page where links doesn't work: https://nordic-payments-council.euwest01.umbraco.io/get-involved/becoming-a-member-of-the-npc/
Page not found: https://nordic-payments-council.euwest01.umbraco.io/%7BlocalLink:a7492aa7-e4b6-4b23-a1e0-64aab83eab4b%7D

Steps to reproduce

N.a.

Expected result / actual result

I expected the link to work or that the documents were to be downloaded.

Copy link

Hi there @Jrod72!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@iOvergaard
Copy link
Contributor

iOvergaard commented Oct 14, 2024

This could be related to #17219, but it seems a bit different. Would you be able to copy/paste the source code of your rich text editor?

A "correct" link should look like this when you press the "view source" button in the rich text editor:

<p><a type="document" href="/{localLink:607c17c1-d6cf-4739-b330-452436e25064}" title="About us">About us</a></p>

(Notice the "type" attribute indicating whether you are linking to a document or media)

@iOvergaard iOvergaard added state/needs-more-info We don't have enough information to give a good reply affected/v14 labels Oct 14, 2024
@Jrod72
Copy link
Author

Jrod72 commented Oct 14, 2024

Rewriting the code according to your example seems to have resolved the issue. The code, before editing according to above could look like:

<li><a rel="noopener" data-udi="umb://media/49ce99d2e6b74583bf9fe6151858eac0" type="media" href="/{localLink:4300c622-9950-4b19-8c58-4b4feddc106b}" target="_blank" title="NPC Internal Rules 4.1"><span>NPC Internal Rules</span></a><span></span></li>

@iOvergaard
Copy link
Contributor

@Jrod72 The code you pasted here, is that the link that works or doesn't work?

@Jrod72
Copy link
Author

Jrod72 commented Oct 14, 2024

Yes, this is one of them. All non working links seems to have been coded the same way in the rich text editor (except for which document the link is refering to and what text is being linked...).

@iOvergaard
Copy link
Contributor

@Jrod72 I see. I tried pasting your link into a 14.3 Backoffice and changed the GUID to one of my images, and the link seems to work. The required attributes type and href with locallink are there, so that's what I would expect.

I'm in doubt whether we need another migration somewhere or what is going on. What did you do to your links to make them work?

@Jrod72
Copy link
Author

Jrod72 commented Oct 15, 2024

I used this code which worked in combination with re-uploading the pdf i the root catalogue in the media section (instead of having the file in a subfolder): <li><a type="media" href="/{localLink:677f16e9-8c73-441c-848d-a55f235f248f}" title="Membership Application"><span>NPC Membership Application Material</span></a><br><br></li> The linking feature in the rich text editor dosen´t seem to operate correctly at all dfor me.

@Jrod72
Copy link
Author

Jrod72 commented Oct 15, 2024

The consequence is that the pdf is shown directly in the browser and I can't make it to download instead which I guess that the "open i new tab" feature makes the file to do?

@iOvergaard
Copy link
Contributor

What you are saying about having to re-upload the file for it to work is surprising to me. That should definitely not be necessary!

Whether a PDF opens in the browser or is downloaded has more to do with your webserver settings and whether that can serve PDFs as a stream. You can force a download of any link by adding the "download" attribute to the A-tag. Umbraco doesn't have any UI to help you set the attribute, but you can edit the source and set it manually. Here is the documentation (from MDN) detailing what it does: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download

@iOvergaard
Copy link
Contributor

iOvergaard commented Oct 15, 2024

Investigating this a bit more, we have found that the order of the attributes on links matters. Consider a link like this taken from your example above:

<a rel="noopener" data-udi="umb://media/49ce99d2e6b74583bf9fe6151858eac0" type="media" href="/{localLink:4300c622-9950-4b19-8c58-4b4feddc106b}" target="_blank" title="NPC Internal Rules 4.1"><span>NPC Internal Rules</span></a>

Since 14.1, the type and href must be the first attributes visible on the element, otherwise the rich text value converter fails to convert it to a link. This is a bug, but it could help you move forward in migrating this. If you rearrange the attributes, it should work:

<a type="media" href="/{localLink:4300c622-9950-4b19-8c58-4b4feddc106b}" rel="noopener" target="_blank" title="NPC Internal Rules 4.1"><span>NPC Internal Rules</span></a>

rel is now after href and I have removed data-udi completely, as that is a legacy from versions lower than 14.1.

We will issue a bug fix to ensure that the order of attributes does not matter.

@martinthogersen
Copy link

@iOvergaard When do you think a fix can be released?

@iOvergaard
Copy link
Contributor

@martinthogersen We are working actively on a fix for the issue with the order of attributes as mentioned above, though I'm not sure if that is the only problem @Jrod72 is experiencing. What issue specifically are you asking about?

@martinthogersen
Copy link

martinthogersen commented Oct 16, 2024

@iOvergaard Here’s an example:

<h2>Irrelevant content</h2>
<p>&nbsp;</p>
<p>Irrelevant content</p>
<h4>Irrelevant content</h4>
<ul>
<li><a rel="noopener" data-udi="umb://media/d7828eeb87b240f48a547ef7ef8a1141" href="/{localLink:umb://media/d2fc77cc6b14465784d5c447da5a8cd0}" target="_blank" title="012024">Skrivbar honorarblanket&nbsp;</a></li>
<li><a rel="noopener noreferrer" data-udi="umb://media/21a77779b76d4e228742302dcb3ff679" type="media" href="/{localLink:4951ddb6-c15e-4569-a8d4-e9185a45201b}" target="_blank" title="Honorarblanket.pdf">Vejledning til honorarblanket&nbsp;</a></li>
</ul>
<h4>Irrelevant content</h4>
<ul>
<li><a rel="noopener" data-udi="umb://media/884ec34300be45139d569667632b102f" type="media" href="/{localLink:e01b8e15-7f35-4b2b-8ffb-209810fdac47}" target="_blank" title="15 012024">Skrivbar honorarblanket&nbsp;</a></li>
<li>Irrelevant content</li>
</ul>
<h4>Irrelevant content</h4>
<ul>
<li><a rel="noopener" data-udi="umb://media/7ff0d6b7d02a49f48edf714186e9b6dc" href="/{localLink:umb://media/7c62b60b22f04fee949ab9245112013f}" target="_blank" title="ng">Skrivbar honorarblanket</a></li>
</ul>
<p>&nbsp;</p>

The links formatted as localLink:umb://media/... are functional, while those in the format {localLink:e01b8e... are not.

To resolve this, I need to remove the non-functional links using the "Remove link" feature in the editor. After that, I can insert the correct links. If I go to "Add/edit link" and select the new link from there, it does not update the link, and it remains broken.

@iOvergaard
Copy link
Contributor

@martinthogersen thanks for the example, that is really helpful!

The links starting with localLink:umb://media/<GUID> is a legacy format that is still supported, however any rich text editor from version 14.1 and onwards should insert links with localLink:<GUID> and an additional type="media" attribute. There is, however, an error currently where the property value converter cannot see these links if the attributes are not placed at the beginning of the <a tag, e.g. <a href="" type="". This is what we are fixing with #17288.

Clicking "Add/edit link" does not update anything because it thinks the link is already correct, which it is. The issue lies in the backend.

You could try and move the rel and data-udi attributes behind href and type and check to see if this bug affects you.

@iOvergaard iOvergaard added release/15.0.0 area/backend and removed state/needs-more-info We don't have enough information to give a good reply labels Oct 16, 2024
@iOvergaard
Copy link
Contributor

This has been fixed and will be included in 15.0.0-rc2, which should be released tomorrow

@martinthogersen
Copy link

@iOvergaard Would it be possible to include in version 14 as well?

@iOvergaard
Copy link
Contributor

iOvergaard commented Oct 17, 2024

@martinthogersen Yes possibly, but no further versions are planned for V14 as 15.0.0 is right around the corner. I have made sure to include the code in the dev branch of V14 where it will be picked up by the next version if it happens, though.

Ref: 1581eb6

@Jrod72
Copy link
Author

Jrod72 commented Oct 17, 2024

Thanks @iOvergaard for sorting the issue for me. I manually cleaned up all links and everything seems to work after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants