MacOS screenshot not showing - Link containing nnbs should be resolved as if there were simple spaces

Steps to reproduce

I add a screenshot to a note and after a while (not sure how long) Obsidian doesn’t correctly parse the link and it shows up as missing. This happened before and persisted after the 1.5.8 update.

Did you follow the troubleshooting guide? [Y/N]

YES

Expected result

I expected to see both identical image tags displaying the same image.

Actual result

The previously added tag is still broken and the newly added tag displays the image.

Environment

SYSTEM INFO:
Obsidian version: v1.5.8
Installer version: v1.4.16
Operating system: Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020 23.3.0
Login status: logged in
Catalyst license: vip
Insider build toggle: on
Live preview: on
Base theme: light
Community theme: none
Snippets enabled: 6
Restricted mode: on

RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.


Additional information

This is the note in Source mode. The image tags/paths are identical and the image is at the location shown. The bottom image is one that was there previously (when the note was created) and the top one is the same image I dragged into the note from the attachments folder.

Switching to reading mode, you can see the older image still isn’t being displayed, but the newly added image (the same one at the same path) is displayed.

Attached is the md file.

Blast Radius.md.zip (639 Bytes)

I opened it with BBedit and used a feature called “Zap Gremlins” which replaces non-ASCII, null, or control characters that are “invisible” with another character in order to see them and it added a bullet here:

So there’s something going on with the file path since replacing this bullet with a normal space (like the actual file name) fixes the issue.

1 Like

we are aware of this. Thanks

What I’m trying to do

I renamed the attachment and note folders in my vault, and have since restored them to their original state. Attachment wikilnks are all broken. Confusingly, if I recreate the links exactly verbatim, the new versions work fine.

Example:

Source view:

Reading view:

I am guessing these Wikilink targets must be stored in a database or JSON file somewhere and mine is out of whack. Is there a way to fix this?

Things I have tried

  • Found a thread related to relative path bug with folder moves, but no solution…
  • Tried forcing reindexing vault.
  • Tried opening in safe mode.
  • Tried renaming attachment folder within Obsidian.
  • Tried renaming notes folder within Obsidian.

They are not the same. The space before AM looks different.

1 Like

Note in case this happens to anyone else: I fixed this across my vault by using VSCode to “find in folder”, replacing all instances of the strange space-like character (in my case U+202F : NARROW NO-BREAK SPACE [NNBSP]) with a regular space. Restored all my attachment links.

Looks like this is the rogue character: \x{202F}. It’s getting added before the ‘AM’ and ‘PM’ in screenshot file names when dragging in screenshots. A find/replace with a space seems to fix.

I have this issue as well (with a lot of screenshots scattered through my notes). Do you know when this will be fixed? Will save me the time of writing a script to replace the 202F character everywhere.

1 Like

Hi, I just wanted to note that I am also experiencing this bug. It seems rather new. Here is my debug info if it is helpful:

SYSTEM INFO:
Obsidian version: v1.5.10
Installer version: v1.4.13
Operating system: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 23.2.0
Login status: logged in
Catalyst license: vip
Insider build toggle: on
Live preview: on
Base theme: light
Community theme: Minimal v7.5.2
Snippets enabled: 1
Restricted mode: on

This is not something that is going to happen going forward (with new links) and we haven’t decided if we want to introduce code to handle this narrow case of the past.

If you have broken screnshot links, just delete the “weird” space before am/pm and add a “regular” space again. It’ll fix the problem.

1 Like

No problem, I appreciate your consideration all the same. I will figure out a good way to fix this for my ~200 attachments. Thanks for the prompt response and great product!

Could someone post their script for fixing this issue?

Here you go. I figured applescript is the most universal way to go. Please backup your vault. I am a terrible coder and not very familiar with applescript. But this worked perfectly for my issues.

Open “Script Editor” on your mac. New Document. Paste. Press run. Select your vault folder (that you have backed up, seriously).

-- PLEASE BACKUP YOUR OBSIDIAN DIRECTORY BEFORE RUNNING THIS SCRIPT


-- Prompt the user to select a directory
set targetDirectory to choose folder with prompt "Select the directory to process:"

-- Convert the selected folder to a string path
set targetPath to POSIX path of targetDirectory

-- Use the 'find' command to get a list of all .md files in the directory and its subdirectories
set findCommand to "find " & quoted form of targetPath & " -type f -name '*.md'"
set mdFiles to paragraphs of (do shell script findCommand)

-- Specify the symbol you want to replace and what you want to replace it with
set oldSymbol to " " -- This might look like a space but it is the errant symbol
set newSymbol to " " -- We're replacing with a space

-- Loop through each .md file and replace the symbol
repeat with aFile in mdFiles
	-- Use 'sed' to replace the symbol in the file
	set sedCommand to "sed -i '' 's/" & oldSymbol & "/" & newSymbol & "/g' " & quoted form of aFile
	
	try
		-- Attempt to execute the 'sed' command
		do shell script sedCommand
	on error errorMessage
		-- Check if the error message contains "No such file or directory", this error occurs when a filename has an "&" in it - so we are skipping those. You'll have to manually fix these.
		if errorMessage contains "No such file or directory" then
			-- Optionally, log the error or simply continue with the next file
			log "Skipping file due to error: " & aFile
		else
			-- If the error is something else, you might want to stop the script or handle it differently
			error "An unexpected error occurred: " & errorMessage
		end if
	end try
end repeat

Does not work for filenames with & in them.

Hope this helps.

Thank you, this worked! For other readers, it seems the script @meatbag posted renders the U+202F character as a regular space. I had to copy the correct character and replace the line where oldSymbol is set.

1 Like