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
636 stars 39 forks source link

[Bug]: File name replacement regex applied to attachment file paths #338

Closed m3adow closed 5 months ago

m3adow commented 5 months ago

Issue validation

Command used

Refresh published and upload new notes

Plugin version

7.0.6

Describe the bug

When using a file name replacement regex, this regex replacement is also used for attachment file paths. This generates very annoying results with regexes which sanitize file names (see example).

Maybe I'm misunderstanding the plugin settings. Ideally, I just want to have my attachments (and docs, but that works) in the same structure as my Obsidian vault, just with sanitized file names (the docs/images subfolder is just for an easier bug report).

How to reproduce ?

  1. Create fresh vault
  2. Attach an image to the welcome page, e.g. This is an example.jpeg; I use _attachments as subfolder name, not sure if that's important
  3. Share the welcome page
  4. Use the plugin configuration below
  5. Refresh published and upload new notes
  6. The image will be named docs-images-This-is-an-example.jpeg and will be located in the root dir

Minimal Reproducible Example

---
share: "true"
---

But why?
![[any-attached-image-here.jpg]]

Configuration

{
  "github": {
    "branch": "main",
    "automaticallyMergePR": true,
    "dryRun": {
      "enable": true,
      "folderName": "github-publisher"
    },
    "tokenPath": "%configDir%/plugins/%pluginID%/env",
    "api": {
      "tiersForApi": "Github Free/Pro/Team (default)",
      "hostname": ""
    },
    "workflow": {
      "commitMessage": "[PUBLISHER] Merge",
      "name": ""
    },
    "verifiedRepo": true
  },
  "upload": {
    "behavior": "obsidian",
    "defaultName": "",
    "rootFolder": "",
    "yamlFolderKey": "",
    "frontmatterTitle": {
      "enable": false,
      "key": "title"
    },
    "replaceTitle": [
      {
        "regex": "/\\W+/g",
        "replacement": "-",
        "type": "title"
      }
    ],
    "replacePath": [],
    "autoclean": {
      "enable": false,
      "excluded": []
    },
    "folderNote": {
      "enable": false,
      "rename": "index.md",
      "addTitle": {
        "enable": false,
        "key": "title"
      }
    },
    "metadataExtractorPath": ""
  },
  "conversion": {
    "hardbreak": false,
    "dataview": true,
    "censorText": [],
    "tags": {
      "inline": false,
      "exclude": [],
      "fields": []
    },
    "links": {
      "internal": false,
      "unshared": false,
      "wiki": false,
      "slugify": "disable"
    }
  },
  "embed": {
    "attachments": true,
    "overrideAttachments": [],
    "keySendFile": [],
    "notes": false,
    "folder": "docs/images",
    "convertEmbedToLinks": "keep",
    "charConvert": "->",
    "useObsidianFolder": false
  },
  "plugin": {
    "shareKey": "share",
    "excludedFolder": [],
    "copyLink": {
      "enable": false,
      "links": "",
      "removePart": [],
      "transform": {
        "toUri": true,
        "slugify": "lower",
        "applyRegex": []
      }
    },
    "setFrontmatterKey": "Set"
  }
}

Relevant log output

No response

OS

Linux

Anything else?

No response

Obsidian information

SYSTEM INFO:
    Obsidian version: v1.5.12
    Installer version: v1.4.13
    Operating system: #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  4 14:39:20 UTC 2 6.5.0-28-generic
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Base theme: adapt to system
    Community theme: none
    Snippets enabled: 0
    Restricted mode: off
    Plugins installed: 1
    Plugins enabled: 1
        1: Github Publisher v7.0.6

RECOMMENDATIONS:
    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 5 months ago

Okay I get it A simple fail can cause a lot of issue :'). Will fix it !

Mara-Li commented 5 months ago

Fixed in beta, will be push in the nex release in 3 days (time to test if everything is good in #336 )