Enveloppe / obsidian-enveloppe

Enveloppe helps you to publish your notes on a GitHub repository from your Obsidian Vault, for free!
https://enveloppe.github.io/
Apache License 2.0
653 stars 39 forks source link

[Plugin][Bug]: plugin behaves unexpectedly when regex is not legal #229

Closed observerw closed 1 year ago

observerw commented 1 year ago

Issue validation

Command used

Upload all notes

Plugin version

6.8.2

Describe the bug

Thank you for your great plugin!:smile:

When using Text & Links - Text Replacer, if user input an illegal regex and upload notes, the plugin will create a new branch but not commit anything, which can be confusing to users(unless user has logging turned on).

In my opinion, if such situation occurs, an error should be thrown immediately and the subsequent process should be terminated as early as possible.

How to reproduce ?

No response

Minimal Reproducible Example

Add an illegal regex in Text & Links - Text Replacer, then upload files.

Configuration

{
  "github": {
    "branch": "main",
    "automaticallyMergePR": true,
    "tokenPath": "%configDir%/plugins/%pluginID%/env",
    "api": {
      "tiersForApi": "Github Free/Pro/Team (default)",
      "hostname": ""
    },
    "workflow": {
      "commitMessage": "[PUBLISHER] Merge",
      "name": ""
    },
    "verifiedRepo": true
  },
  "upload": {
    "behavior": "fixed",
    "defaultName": "content/post",
    "rootFolder": "",
    "yamlFolderKey": "",
    "frontmatterTitle": {
      "enable": false,
      "key": "title"
    },
    "replaceTitle": [],
    "replacePath": [],
    "autoclean": {
      "enable": false,
      "excluded": []
    },
    "folderNote": {
      "enable": false,
      "rename": "index.md"
    },
    "metadataExtractorPath": ""
  },
  "conversion": {
    "hardbreak": false,
    "dataview": true,
    "censorText": [
      {
        "entry": "/!\\\\[\\[([^[\\]]+)\\]\\]/",
        "replace": "![$1](/$1)",
        "flags": "",
        "after": false
      }
    ],
    "tags": {
      "inline": false,
      "exclude": [],
      "fields": []
    },
    "links": {
      "internal": false,
      "unshared": false,
      "wiki": false,
      "slugify": false
    }
  },
  "embed": {
    "attachments": true,
    "forcePushAttachments": [],
    "keySendFile": [],
    "notes": false,
    "folder": "static",
    "convertEmbedToLinks": "keep",
    "charConvert": "->"
  }
}

Relevant log output

No response

OS

No response

Anything else?

No response

Obsidian information

SYSTEM INFO:
    Obsidian version: v1.4.16
    Installer version: v1.4.13
    Operating system: Darwin Kernel Version 23.0.0: Fri Sep 15 14:43:05 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6020 23.0.0
    Login status: not logged in
    Insider build toggle: off
    Live preview: off
    Legacy editor: off
    Base theme: light
    Community theme: Minimal v7.2.0
    Snippets enabled: 2
    Restricted mode: off
    Plugins installed: 36
    Plugins enabled: 25
        1: Clear Unused Images v1.1.0
        2: Dataview v0.5.59
        3: Text Generator v0.3.20
        4: Advanced Slides v1.20.0
        5: Advanced Tables v0.19.1
        6: ChatGPT MD v1.5.0
        7: Pandoc Plugin v0.4.1
        8: Better Word Count v0.10.0
        9: Calendar v1.5.10
        10: Kanban v1.5.3
        11: Templater v1.16.3
        12: Periodic Notes v0.0.17
        13: Footnote Shortcut v0.1.3
        14: Minimal Theme Settings v7.2.4
        15: Hider v1.3.1
        16: Style Settings v1.0.7
        17: Iconize v2.3.1
        18: Excalidraw v1.9.20
        19: Outliner v4.8.0
        20: File Explorer Note Count v1.2.1
        21: Update time on edit v2.4.0
        22: Paste URL into selection v1.7.0
        23: Easy Typing v5.1.10
        24: ZotLit v1.1.2
        25: Github Publisher v6.8.2

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.
    Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
Mara-Li commented 1 year ago

Ty, will try to repro and fix!

Mara-Li commented 1 year ago

Hello! The plugin has been updated. If you try to register a bad regex, the plugin will now refuse to save it!