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

Updating notes does not update all lines #86

Open
panglesd opened this issue Jun 12, 2023 · 4 comments
Open

Updating notes does not update all lines #86

panglesd opened this issue Jun 12, 2023 · 4 comments

Comments

@panglesd
Copy link

First of all, thanks for maintaining this tool.

Sometimes, when using the notes update command, the note is not fully updated. Here is a fairly small example/reproduction:

$ hackmd-cli notes create --content='
aa

```    
aab 
```

aab' 
 ID                     Title    User path Team path 
 ────────────────────── ──────── ───────── ───────── 
 59bbDYGPSESuaJuBh_fD4A Untitled gitmd         

to create a note with some content. Now, update it with some other content:

$ hackmd-cli notes update  --noteId 59bbDYGPSESuaJuBh_fD4A --content='
aa

```json
aabc
```

aabc'

However, the last modification (the last line) is not taken into account:

$ hackmd-cli export --noteId 59bbDYGPSESuaJuBh_fD4A

aa

```json
aabc
```

aab

If I do the hackmd-cli notes update command again, the content of the note matches what is required.
However, I've seen some old content/new content pairs where hackmd-cli notes update does nothing...

This seems to be a hackmd API bug (rather than the CLI), as I tried to directly write the HTTP requests, and it fails. But I could not find any github repository where we can file issues on the API itself. Feel free to redirect me if I'm not opening the issue in the right repo!

(while writing the HTTP requests by hand, I've also seen a case where writing a newline at the end of the JSON payload would change the outcome of the "update" API request... if that helps to track the bug)

@panglesd panglesd changed the title Updating notes does not updates all lines Updating notes does not update all lines Jun 12, 2023
@g-gundam
Copy link

g-gundam commented Jan 3, 2024

@panglesd I'm also running into this issue on a long markdown documents that don't seem to update. A workaround I've had luck with is to:

  • set --content="something small"
  • then set --content="the original long document"

For some reason, this seems to update the document. I don't know why.

@panglesd
Copy link
Author

panglesd commented Jan 7, 2024

Thanks for the workaround!

I am just a little bit worried the content would be stuck with "something small", which might be worse than not updating the document fully. But since you've had luck with this, I might try this!

(I'm using this to automatically synchronise hackmd with some other storage, so it's not always practical to manually act when it has not worked...)

@g-gundam
Copy link

g-gundam commented Jan 8, 2024

Hopefully, they fix this. I'm not using it for anything important, so I can afford to take this risk, but something as fundamental as updating a note should Just Work™.

@g-gundam
Copy link

UPDATE: My workaround has been pretty reliable. However, I ran into a new bug where if the document is longer than 100,000 bytes, it'll refuse to accept it saying the document is too big. I find that strange, because the site itself allows documents longer than that, but I can't send a document of that size using the CLI tool.

Update note content failed
    Error: Received an error response (413 Payload Too Large) from HackMD
    Code: 413

This isn't the same bug, but it's tangentially related to updates not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants