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

Video links href and text content do not match #211

Open
kptdobe opened this issue Nov 30, 2022 · 4 comments
Open

Video links href and text content do not match #211

kptdobe opened this issue Nov 30, 2022 · 4 comments
Labels
question Further information is requested

Comments

@kptdobe
Copy link

kptdobe commented Nov 30, 2022

To upload a video, an author chats with the franklin bot and gets a link like https://main--express-website--adobe.hlx.page/media_1f4b5e29362b67df45103c598e4b15e7777159e31.mp4.

When rendered, the link becomes: <a href="./media_1f4b5e29362b67df45103c598e4b15e7777159e31.mp4">https://main--express-website--adobe.hlx.page/media_1f4b5e29362b67df45103c598e4b15e7777159e31.mp4</a> which is technically a correct transformation only on pages at the root: as soon as the link appears on a page in a folder, the mapping href / a.textContent is not correct.

We used to use that mapping for certain detections and this logic became invalid with the v7 pipeline.

We know it is the same asset, just the urls do not match. Not a "big" deal neither, maybe we can have a better solution.
I do not think <a href="./media_1f4b5e29362b67df45103c598e4b15e7777159e31.mp4">./media_1f4b5e29362b67df45103c598e4b15e7777159e31.mp4</a> is nice neither.
Is it possible to have the correct absolute URL ?

@kptdobe kptdobe added the question Further information is requested label Nov 30, 2022
@tripodsan
Copy link
Contributor

Is it possible to have the correct absolute URL ?

sure.

@tripodsan
Copy link
Contributor

so given a link https://main--owner--repo.hlx.page/media_1234.mp4, requesting a page /foo/bar, currently it is:

  • on page: <a href="./media_1234.mp4">https://main--owner--repo.hlx.page/media_1234.mp4</a>
  • on live: <a href="./media_1234.mp4">https://main--owner--repo.hlx.page/media_1234.mp4</a>
  • on prod: <a href="./media_1234.mp4">https://main--owner--repo.hlx.page/media_1234.mp4</a>

a) we could either adjust the content accordingly, which would be the simplest:

  • on page: <a href="./media_1234.mp4">./media_1234.mp4</a>
  • on live: <a href="./media_1234.mp4">./media_1234.mp4</a>
  • on prod: <a href="./media_1234.mp4">./media_1234.mp4</a>

b) make it absolute with the host and path:

  • on page: <a href="./media_1234.mp4">https://main--owner--repo.hlx.page/foo/bar/media_1234.mp4</a>
  • on live: <a href="./media_1234.mp4">https://main--owner--repo.hlx.live/foo/bar/media_1234.mp4</a>
  • on prod: <a href="./media_1234.mp4">https://www.example.com/foo/bar/media_1234.mp4</a>

I think that a) is better, as it has less potential to cause problems with caching.
In any case, this would be a breaking change.

@davidnuescheler WDYT?

@kptdobe
Copy link
Author

kptdobe commented Jun 19, 2023

In JS:

  • with a): a.href !== a.textContent
  • with b): a.href === a.textContent

I prefer b) because it is more aligned with what the author has pasted in Word.

@tripodsan
Copy link
Contributor

actually, I was wrong. we don't rewrite the prod host, so b) would be:

b) make it absolute with the host and path:

- on page: `<a href="./media_1234.mp4">https://main--owner--repo.hlx.page/foo/bar/media_1234.mp4</a>`
- on live: `<a href="./media_1234.mp4">https://main--owner--repo.hlx.live/foo/bar/media_1234.mp4</a>`
- on prod: `<a href="./media_1234.mp4">https://main--owner--repo.hlx.live/foo/bar/media_1234.mp4</a>`

which is also not great. I think a) (maybe w/o the ./ ) would be the best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants