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

[Plugin][Bug]: Bug when share is empty #226

Closed
2 tasks done
anareaty opened this issue Sep 29, 2023 · 2 comments
Closed
2 tasks done

[Plugin][Bug]: Bug when share is empty #226

anareaty opened this issue Sep 29, 2023 · 2 comments
Assignees
Labels
🐛 Bug Something isn't working 💎 Obsidian Github Publisher Related to the plugin

Comments

@anareaty
Copy link

Issue validation

  • I checked the issue to prevent duplicate
  • I checked my configurations files and the documentation

Command used

Refresh published and upload new notes

Plugin version

6.7.1

Describe the bug

I was able to publish some individual notes just fine, but when I tried to reftesh and upload several notes at once, I got this bug.

plugin:obsidian-mkdocs-publisher:19 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'toString')
    at ce (plugin:obsidian-mkdocs-publisher:19:53057)
    at Ys.getAllFileWithPath (plugin:obsidian-mkdocs-publisher:28:10213)
    at eval (plugin:obsidian-mkdocs-publisher:23:20428)
    at Generator.next (<anonymous>)
    at eval (plugin:obsidian-mkdocs-publisher:2:871)
    at new Promise (<anonymous>)
    at m (plugin:obsidian-mkdocs-publisher:2:691)
    at so (plugin:obsidian-mkdocs-publisher:23:20333)
    at eval (plugin:obsidian-mkdocs-publisher:23:22746)
    at Generator.next (<anonymous>)

After some picking around I figured out the issue: one of my notes had the "share" property empty instead of true or false. After turning it to false the bug vanished. I looked at the code, and the thing is, it does not check if the property equals exactly null, and Obsidian does not treat null and false as the same thing anymore. It seems to be easy enough to fix, just add additional check for null along with undefined.

How to reproduce ?

Create the note with the empty share property (can be created in the source mode) and try to share it of several notes at once.

Minimal Reproducible Example

-

Configuration

-

Relevant log output

No response

OS

No response

Anything else?

No response

Obsidian information

-
@anareaty anareaty added 🐛 Bug Something isn't working 💎 Obsidian Github Publisher Related to the plugin labels Sep 29, 2023
@Mara-Li
Copy link
Member

Mara-Li commented Sep 29, 2023

Oh ! Good catch umu! Will fix that asap :)

(And yes, undefined = "not exists" and "null" = empty value)

Mara-Li added a commit that referenced this issue Sep 29, 2023
Obsidian doesn't treat an empty property as a "non existant" property. So, undefined & null are different:
- null → The key exists, but the value is empty (null)
- undefined → The key doesn't exist

An empty value → create a crash

fix [Plugin][Bug]: Bug when share is empty #226
@Mara-Li
Copy link
Member

Mara-Li commented Sep 29, 2023

Please, try the new version <3

@Mara-Li Mara-Li closed this as completed Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working 💎 Obsidian Github Publisher Related to the plugin
Projects
None yet
Development

No branches or pull requests

2 participants