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

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

Closed
3 tasks done
m3adow opened this issue May 3, 2024 · 2 comments
Closed
3 tasks done

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

m3adow opened this issue May 3, 2024 · 2 comments
Assignees
Labels
🐛 Bug Something isn't working

Comments

@m3adow
Copy link

m3adow commented May 3, 2024

Issue validation

  • I checked the issue to prevent duplicate
  • I checked my configurations files and the documentation
  • My issue concern doesn't concern the Mkdocs template

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.
@m3adow m3adow added the 🐛 Bug Something isn't working label May 3, 2024
@Mara-Li
Copy link
Member

Mara-Li commented May 4, 2024

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

@Mara-Li Mara-Li closed this as completed in 8d5a441 May 4, 2024
@Mara-Li
Copy link
Member

Mara-Li commented May 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants