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]: Notes are deleted when trying to upload #355

Closed
2 tasks done
anareaty opened this issue Jul 5, 2024 · 16 comments
Closed
2 tasks done

[Bug]: Notes are deleted when trying to upload #355

anareaty opened this issue Jul 5, 2024 · 16 comments
Assignees
Labels
🐛 Bug Something isn't working

Comments

@anareaty
Copy link

anareaty commented Jul 5, 2024

Issue validation

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

Command used

Upload single current active note

Plugin version

7.2.10

Describe the bug

When I tried to upload a new note, nothing is added, but instead all notes that was already uploaded were deleted from repository. Trying to reupload any file, I get the message that it is added and deleted at the same time.
I tried to publish some new notes and noticed that sometimes the new note uploads when you publish in the first time, but gets deleted when you try to reupload it again. Sometimes it doesn't work even the first time.

How to reproduce ?

  1. Create the file in Obsidian named "Test-note".
  2. In plugin settings turn on the option "Auto clean up"
  3. Try to upload the note.
  4. Try to upload the note again.

Minimal Reproducible Example

Test-note.md


---
share: true
---
Text


### Configuration

```JSON
{
  "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": "yaml",
    "defaultName": "",
    "rootFolder": "",
    "yamlFolderKey": "",
    "frontmatterTitle": {
      "enable": false,
      "key": ""
    },
    "replaceTitle": [],
    "replacePath": [],
    "autoclean": {
      "includeAttachments": false,
      "enable": true,
      "excluded": [
        "images/"
      ]
    },
    "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": true,
      "unshared": true,
      "wiki": false,
      "slugify": true
    }
  },
  "embed": {
    "attachments": true,
    "overrideAttachments": [],
    "keySendFile": [],
    "notes": true,
    "folder": "content/images",
    "convertEmbedToLinks": "bake",
    "charConvert": "->",
    "unHandledObsidianExt": [],
    "sendSimpleLinks": false,
    "forcePushAttachments": [],
    "bake": {
      "textBefore": "",
      "textAfter": ""
    }
  },
  "plugin": {
    "shareKey": "share",
    "excludedFolder": [],
    "copyLink": {
      "enable": false,
      "links": "",
      "removePart": [],
      "transform": {
        "toUri": true,
        "slugify": "lower",
        "applyRegex": []
      }
    },
    "setFrontmatterKey": "Set"
  },
  "tabsId": "upload-configuration"
}

Relevant log output

plugin:obsidian-mkdocs-publisher:175 [Enveloppe](GithubBranch.newBranchOnRepo):
 Branch successfully created (status: 201) on anareaty/paperless-forest
plugin:obsidian-mkdocs-publisher:175 [Enveloppe](GithubBranch.uploadOnMultipleRepo):
 Upload Test-note.md:Test-note.md on anareaty/paperless-forest:Obsidian-7-5-2024
plugin:obsidian-mkdocs-publisher:22 
        
        
       GET https://api.github.com/repos/anareaty/paperless-forest/contents/Test-note.md?ref=Obsidian-7-5-2024 404 (Not Found)
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
e.onSuggestionClick @ app.js:1
s @ enhance.js:1
plugin:obsidian-mkdocs-publisher:175 [Enveloppe](deleteFromGithubOneRepo):
 trying to delete file : Test-note.md from anareaty/paperless-forest

OS

No response

Anything else?

When trying to upload the note I got this message:

upload-message

Obsidian information

SYSTEM INFO:
	Obsidian version: v1.6.5
	Installer version: v1.6.5
	Operating system: Windows 10 Pro 10.0.19045
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Base theme: light
	Community theme: none
	Snippets enabled: 101
	Restricted mode: off
	Plugins installed: 40
	Plugins enabled: 1
		1: Enveloppe v7.2.10
@anareaty anareaty added the 🐛 Bug Something isn't working label Jul 5, 2024
@Mara-Li
Copy link
Member

Mara-Li commented Jul 5, 2024

I already had this bug on my side…
I totally forgot what can cause it.

Maybe it's something around the configuration of sharing key and the repository?

@Mara-Li
Copy link
Member

Mara-Li commented Jul 5, 2024

Well, your configuration is wrong:

  • You set yaml key
  • But didn't set the default key.

The plugin seems to struggle to found the folder, create a wrong default path, and explode.

@anareaty
Copy link
Author

anareaty commented Jul 5, 2024

The bug persists if I add the property key:

{
"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": "yaml",
"defaultName": "",
"rootFolder": "",
"yamlFolderKey": "path",
"frontmatterTitle": {
"enable": false,
"key": ""
},
"replaceTitle": [],
"replacePath": [],
"autoclean": {
"includeAttachments": false,
"enable": true,
"excluded": [
"images/"
]
},
"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": true,
"unshared": true,
"wiki": false,
"slugify": true
}
},
"embed": {
"attachments": true,
"overrideAttachments": [],
"keySendFile": [],
"notes": true,
"folder": "content/images",
"convertEmbedToLinks": "bake",
"charConvert": "->",
"unHandledObsidianExt": [],
"sendSimpleLinks": false,
"forcePushAttachments": [],
"bake": {
"textBefore": "",
"textAfter": ""
}
},
"plugin": {
"shareKey": "share",
"excludedFolder": [],
"copyLink": {
"enable": false,
"links": "",
"removePart": [],
"transform": {
"toUri": true,
"slugify": "lower",
"applyRegex": []
}
},
"setFrontmatterKey": "Set"
},
"tabsId": "upload-configuration"
}

File:

---
share: true
path: content
---
Text

@anareaty
Copy link
Author

anareaty commented Jul 5, 2024

upload-message1

@Mara-Li
Copy link
Member

Mara-Li commented Jul 5, 2024

Try to provide default folder too

@Mara-Li
Copy link
Member

Mara-Li commented Jul 5, 2024

How the file can be published into content if you set no folder?

@anareaty
Copy link
Author

anareaty commented Jul 5, 2024

This setup does not work too:

{
"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": "yaml",
"defaultName": "content",
"rootFolder": "content",
"yamlFolderKey": "path",
"frontmatterTitle": {
"enable": false,
"key": ""
},
"replaceTitle": [],
"replacePath": [],
"autoclean": {
"includeAttachments": false,
"enable": true,
"excluded": [
"images/"
]
},
"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": true,
"unshared": true,
"wiki": false,
"slugify": true
}
},
"embed": {
"attachments": true,
"overrideAttachments": [],
"keySendFile": [],
"notes": true,
"folder": "content/images",
"convertEmbedToLinks": "bake",
"charConvert": "->",
"unHandledObsidianExt": [],
"sendSimpleLinks": false,
"forcePushAttachments": [],
"bake": {
"textBefore": "",
"textAfter": ""
}
},
"plugin": {
"shareKey": "share",
"excludedFolder": [],
"copyLink": {
"enable": false,
"links": "",
"removePart": [],
"transform": {
"toUri": true,
"slugify": "lower",
"applyRegex": []
}
},
"setFrontmatterKey": "Set"
},
"tabsId": "upload-configuration"
}

@Mara-Li
Copy link
Member

Mara-Li commented Jul 5, 2024

Please reply to my question…

@anareaty
Copy link
Author

anareaty commented Jul 5, 2024

What do you mean I set no folder? I set the "content" folder in the "path" variable.
Also I should mention that everithing is published just fine if I turn off "Auto clean up" option. And also everything worked in some older realises. But trying to publish the file after the latest uplate wiped all my older published files.

@Mara-Li
Copy link
Member

Mara-Li commented Jul 5, 2024

For the second test, did you remove the path from the frontmatter?

Could you please active the developper logs and check what happens ?

The option is in the end of the last tab option

@anareaty
Copy link
Author

anareaty commented Jul 5, 2024

No, I did not remove the path from the frontmatter.
Here are the logs:

[Enveloppe](GithubBranch.newBranchOnRepo):
 Branch successfully created (status: 201) on anareaty/paperless-forest
plugin:obsidian-mkdocs-publisher:175 DEV LOGS [19:16:28.184] GithubBranch.publish:
 Publishing file: Test-note.md
plugin:obsidian-mkdocs-publisher:175 DEV LOGS [19:16:28.191] GithubBranch.publish:
 Publishing Test-note.md to [anareaty/paperless-forest/main] 
plugin:obsidian-mkdocs-publisher:175 [Enveloppe](GithubBranch.uploadOnMultipleRepo):
 Upload Test-note.md:content/Test-note.md on anareaty/paperless-forest:Test-plugins-7-5-2024
plugin:obsidian-mkdocs-publisher:22 
        
        
       GET https://api.github.com/repos/anareaty/paperless-forest/contents/content%2FTest-note.md?ref=Test-plugins-7-5-2024 404 (Not Found)
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
e.onSuggestionClick @ app.js:1
s @ enhance.js:1
plugin:obsidian-mkdocs-publisher:175 DEV LOGS [19:16:28.648] 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/Test-note.md from anareaty/paperless-forest

@Mara-Li
Copy link
Member

Mara-Li commented Jul 7, 2024

Okay the bug seems to happens in the last version of the plugin

@Mara-Li
Copy link
Member

Mara-Li commented Jul 7, 2024

Sorry for the delay, I was pretty tired. The commit dd2aad5 added this bug so reverting should fix it.

@Mara-Li
Copy link
Member

Mara-Li commented Jul 7, 2024

Should be fixed in 7.2.11. Sorry again

@Mara-Li Mara-Li closed this as completed Jul 7, 2024
@lovettbarron
Copy link

Sorry to add a comment to the closed.
I'm still having this bug pop up with the updated plugin 7.2.11.
This is generated when using upload current active note, and none of the "edited" notes are actually edited in this context. Is there a workaround you might suggest, or a "cache clear" option I can try?
Screenshot 2024-07-15 at 13 28 43

@Mara-Li
Copy link
Member

Mara-Li commented Jul 15, 2024

Please open a new issue.

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

3 participants