obsidianmd / obsidian-clipper

Highlight and capture the web in your favorite browser. The official Web Clipper extension for Obsidian.
https://obsidian.md/clipper
MIT License
1.09k stars 59 forks source link

BUG: Clipping a Website with a space character in field "note name" results in empty obsidian note #200

Open Atomique opened 1 week ago

Atomique commented 1 week ago

Version (please complete the following information):

Describe the bug

If I try to clip a website, the web clipper cant create a note from this website if the note name field contains a space character. If I remove the space characters (by simply creating it with "test") it gets created without any problems.

Expected behavior

The note should be created with the auto filled values and with space characters inside the note name.

URLs where the bug occurs

But it doesnt matter, seems like it is a problem on any site.

To reproduce

Steps to reproduce the behavior:

  1. Open a website
  2. clip a website with a space in the notes title (not the title field!)
  3. check if it is working without any spaces by redoing it without spaces.
  4. See error

image image image image

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": "99-UTILS/Clippings"
}
kepano commented 1 week ago

This is strange... I assume your OS allows files with spaces in the names? Do you see any errors in the Obsidian developer console?

Atomique commented 2 days ago

Hi @kepano

thanks a lot for your patience. I will now add the output of the developer console:

image

My OS (Fedora 41 KDE) has no problems with spaces in names. I can also create files (especially obsidian markdown files) with spaces in their names.

kepano commented 2 days ago

Thanks. Looking at what you sent I cannot think of any reason why the title is not appearing correctly. It seems like the correct URI is being received. I tested the URI below on my side and it seems like the file name is coming through correctly.

obsidian://new?file=99-UTILS%2FClippings%2FFusilli%20mit%20Thunfisch%20-%20Rezept&clipboard

Are you using any plugins that might affect the name of the file? E.g. Templater, Linter, or others?

Atomique commented 1 day ago

Normally I would answer this question with yes, because I am using both that you named here. I opened up a new vault now for testing purposes and didnt install any plugins. The problem still persists and I dont have any clue why.

Edit / Addendum: I was wondering if Firefox is able to do it and it is. So these are the working combinations, hope that helps:

What is not working:

kepano commented 1 day ago

Can you confirm that everything below is true?

  1. Firefox: the extension works correctly, even if the note title contains spaces.
  2. Chromium browsers: the extension works correctly as long as the note title does not contain any spaces.
  3. Chromium browsers: if the note title contains spaces, a note gets created with only the first word as its title and nothing else.

Assuming everything above is true... what happens when you open this URL in Firefox vs Chrome? (Copy paste the URL into your URL bar in each browser).

obsidian://new?file=99-UTILS%2FClippings%2FFusilli%20mit%20Thunfisch%20-%20Rezept&clipboard