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
603 stars 38 forks source link

[Bug]: Upload Single Current Active Note/Upload Unpublished Note uploads then deletes, merges with no changes. #356

Closed lovettbarron closed 1 month ago

lovettbarron commented 1 month ago

Issue validation

Command used

Upload single current active note

Plugin version

7.2.11

Describe the bug

I think this is a repeat or regression of the bug that was supposed to be fixed in #355

Basically note will be uploaded, then deleted, and the various commits are meged in without a realized change.

Screenshot 2024-07-16 at 09 27 28

How to reproduce ?

  1. Open command pallette with single note open
  2. Upload Single Current Active Note

Minimal Reproducible Example

---
date: 2024-06-12T20:30
modified: 2024-07-15T13:00
tags:
  - product
  - nodejs
  - opensource
title: rehype-jsoncanvas
public: true
hidden: false
---
# rehype-jsoncanvas

**This project is currently in active development/prove of concept stage and has a number of limitations. But feel free to fork, PR, or add issues if you have requests and I will respond quickly.**

[View on Github](https://github.com/lovettbarron/rehype-jsoncanvas)  
[View on NPM](https://www.npmjs.com/package/rehype-jsoncanvas)

Configuration

{
  "github": {
    "branch": "main",
    "automaticallyMergePR": true,
    "dryRun": {
      "enable": false,
      "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": "_content",
    "rootFolder": "",
    "yamlFolderKey": "",
    "frontmatterTitle": {
      "enable": false,
      "key": "title"
    },
    "replaceTitle": [],
    "replacePath": [],
    "autoclean": {
      "includeAttachments": true,
      "enable": true,
      "excluded": []
    },
    "folderNote": {
      "enable": false,
      "rename": "index.md",
      "addTitle": {
        "enable": false,
        "key": "title"
      }
    },
    "metadataExtractorPath": ""
  },
  "conversion": {
    "hardbreak": false,
    "dataview": true,
    "censorText": [],
    "tags": {
      "inline": true,
      "exclude": [],
      "fields": []
    },
    "links": {
      "internal": true,
      "unshared": true,
      "wiki": true,
      "slugify": "lower"
    }
  },
  "embed": {
    "attachments": true,
    "overrideAttachments": [],
    "keySendFile": [
      "image"
    ],
    "notes": false,
    "folder": "public/assets",
    "convertEmbedToLinks": "keep",
    "charConvert": "->",
    "unHandledObsidianExt": [
      "canvas",
      "canvas.md"
    ],
    "sendSimpleLinks": true,
    "useObsidianFolder": false
  },
  "plugin": {
    "shareKey": "public",
    "excludedFolder": [
      "_util",
      "_assets",
      "_draft"
    ],
    "copyLink": {
      "enable": false,
      "links": "",
      "removePart": [],
      "transform": {
        "toUri": true,
        "slugify": "lower",
        "applyRegex": []
      }
    },
    "setFrontmatterKey": "Set"
  },
  "tabsId": "plugin-settings"
}

Relevant log output

[Enveloppe](GithubBranch.newBranchOnRepo):
 Branch successfully created (status: 201) on lovettbarron/2024.garden
plugin:obsidian-mkdocs-publisher:175 DEV LOGS [07:26:47.906] GithubBranch.publish:
 Publishing file: note/rehype-jsoncanvas-test.md
plugin:obsidian-mkdocs-publisher:175 DEV LOGS [07:26:47.910] GithubBranch.publish:
 Publishing rehype-jsoncanvas-test.md to [lovettbarron/2024.garden/main] 
plugin:obsidian-mkdocs-publisher:175 [Enveloppe](GithubBranch.uploadOnMultipleRepo):
 Upload rehype-jsoncanvas-test.md:_content/note/rehype-jsoncanvas-test.md on lovettbarron/2024.garden:books-7-16-2024
plugin:obsidian-mkdocs-publisher:22     GET https://api.github.com/repos/lovettbarron/2024.garden/contents/_content%2Fnote%2Frehype-jsoncanvas-test.md?ref=books-7-16-2024 404
fetchWrapper @ plugin:obsidian-mkdocs-publisher:22
request2 @ plugin:obsidian-mkdocs-publisher:22
hook @ plugin:obsidian-mkdocs-publisher:24
eval @ plugin:obsidian-mkdocs-publisher:6
Promise.then (async)
register @ plugin:obsidian-mkdocs-publisher:6
Object.assign.endpoint @ plugin:obsidian-mkdocs-publisher:22
upload @ plugin:obsidian-mkdocs-publisher:39
uploadText @ plugin:obsidian-mkdocs-publisher:39
uploadOnMultipleRepo @ plugin:obsidian-mkdocs-publisher:39
await in uploadOnMultipleRepo (async)
publish @ plugin:obsidian-mkdocs-publisher:39
await in publish (async)
shareOneNote @ plugin:obsidian-mkdocs-publisher:27
await in shareOneNote (async)
checkCallback @ plugin:obsidian-mkdocs-publisher:27
RK @ app.js:1
t.onChooseItem @ app.js:1
t.onChooseSuggestion @ app.js:1
t.selectSuggestion @ app.js:1
e.useSelectedItem @ app.js:1
(anonymous) @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1
plugin:obsidian-mkdocs-publisher:175 DEV LOGS [07:26:48.251] GithubBranch.upload:
 The 404 error is normal ! It means that the file does not exist yet. Don't worry ❤️.
plugin:obsidian-mkdocs-publisher:175 [Enveloppe](deleteFromGithubOneRepo):
 trying to delete file : _content/note/rehype-jsoncanvas-test.md from lovettbarron/2024.garden

OS

MacOS

Anything else?

The file also didn't seem to upload while using Refresh Published and Upload New Notes.

Obsidian information

SYSTEM INFO:
    Obsidian version: v1.6.5
    Installer version: v1.4.14
    Operating system: Darwin Kernel Version 23.5.0: Wed May  1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103 23.5.0
    Login status: logged in
    Catalyst license: none
    Insider build toggle: off
    Live preview: on
    Base theme: dark
    Community theme: Things v2.1.20
    Snippets enabled: 0
    Restricted mode: off
    Plugins installed: 32
    Plugins enabled: 23
        1: QuickAdd v1.10.0
        2: Templater v2.3.3
        3: Longform v2.0.7
        4: Readwise Official v2.0.1
        5: Dataview v0.5.67
        6: Recent Files v1.4.1
        7: Better Word Count v0.10.1
        8: Enveloppe v7.2.11
        9: Edit MDX v1.0.1
        10: Bulk Rename v0.5.2
        11: Periodic Notes v0.0.17
        12: Calendar v1.5.10
        13: Yaml Manager v1.3.3
        14: Paste image rename v1.6.1
        15: Highlight Public Notes v1.6.0
        16: Regex Find/Replace v1.2.0
        17: Multi Properties v1.1.1
        18: Clear Unused Images v1.1.0
        19: Update time on edit v2.4.0
        20: Find orphaned files and broken links v1.10.0
        21: Linter v1.25.0
        22: Kanban v2.0.51
        23: Local Images Plus v0.15.9

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.
lovettbarron commented 1 month ago

Very quick update. While trying to figure this out, I saw that one of the files (a week note) did upload, but the jsoncanvas one didn't.

Screenshot 2024-07-16 at 10 37 22

I thought that perhaps that was the cause, so modified unHandledObsidianExt to only have "canvas" and tried again. However the same result occurs.

Note, this is using the command Upload Unpublished Notes

Screenshot 2024-07-16 at 10 43 36
Mara-Li commented 1 month ago

Can't repro :/ Tried on a fresh vault, with two different note, with settings provided.

Mara-Li commented 1 month ago

Oh god, I found it You set your file into _content/** and publish into _content/** It should create somethings like _content/_content

But as I use regex to create path, it struggle and delete the two: image

Mara-Li commented 1 month ago

Oaky. It's more complicated. You set canvas.md as attachment. And the file is named "rehypejsoncanvas.md` So it send it into attachment…