obsidianmd / obsidian-clipper

Official web clipper extension for Obsidian.
https://obsidian.md
MIT License
762 stars 27 forks source link

BUG: embedded image link incorrect #119

Open mattimustang opened 6 days ago

mattimustang commented 6 days ago

Version (please complete the following information):

Describe the bug

The relative paths for images in this page are being resolved incorrectly resulting in the embedded images in the Obsidian note that is created having the incorrect URL.

This page, https://learn.microsoft.com/en-us/compliance/anz/e8-mfa-maturity-level-2, has 1 image on it with the HTML markup with a relative URL:

<img src="../media/e8-mfa-maturity-level-2.png" alt="Visual illustration of the maturity level 2 ACSC requirements" data-linktype="relative-path">

when it is saved to Obsidian the URL is incorrect:

![Visual illustration of the maturity level 2 ACSC requirements](https://learn.microsoft.com/media/e8-mfa-maturity-level-2.png)

The correct URL in Obisidan should be:

![Visual illustration of the maturity level 2 ACSC requirements](https://learn.microsoft.com/en-us/compliance/media/e8-mfa-maturity-level-2.png)

To reproduce Steps to reproduce the behavior:

  1. Go to 'https://learn.microsoft.com/en-us/compliance/anz/e8-mfa-maturity-level-2'
  2. Click on 'Obsidian Web Clipper'
  3. Add the page to obsidian
  4. Inspect the Obsidian Note to see the embedded image URL incorrect and image not rendered.

Expected behavior Embedded Image URL is correct and image rendered correctly.

Your template file

{
    "schemaVersion": "0.1.0",
    "name": "Default",
    "behavior": "create",
    "noteContentFormat": "{{content}}",
    "properties": [
        {
            "name": "title",
            "value": "{{title}}",
            "type": "text"
        },
        {
            "name": "source",
            "value": "{{url}}",
            "type": "text"
        },
        {
            "name": "author",
            "value": "{{author|split:\\\", \\\"|wikilink|join}}",
            "type": "multitext"
        },
        {
            "name": "published",
            "value": "{{published}}",
            "type": "date"
        },
        {
            "name": "created",
            "value": "{{date}}",
            "type": "date"
        },
        {
            "name": "description",
            "value": "{{description}}",
            "type": "text"
        },
        {
            "name": "tags",
            "value": "clippings",
            "type": "multitext"
        }
    ],
    "triggers": [],
    "noteNameFormat": "{{title}}",
    "path": "_inbox/{{date|date:YYYY-MM-DD}}"
}
Azmoinal commented 5 days ago

Same problem after clipping from this page:

https://www.earmi.it/balistica/acustica.htm

All gif images have a link without the word "balistica" leading to an incorrect url.

It is:

![acustica](https://www.earmi.it/img/acu8.gif)

It should be

![acustica](https://www.earmi.it/balistica/img/acu8.gif)
mattimustang commented 3 days ago

@Azmoinal Yes that page has relative image URLs as well

<img src="img/acu8.gif" alt="acustica" height="48" width="155">