requarks / wiki-v1

Legacy version (1.x) of Wiki.js
https://wiki.js.org
GNU Affero General Public License v3.0
101 stars 75 forks source link

cannot delete a page #111

Open cassie-zhu opened 5 years ago

cassie-zhu commented 5 years ago

Actual behavior

  1. add a page
  2. click delete button
  3. it will pop up a dialog to confirm
  4. click delete button
  5. cannot delete

    Expected behavior

    delete success

    Steps to reproduce the behavior

baer95 commented 5 years ago

I just installed wiki.js verision 1.0.102 and had the same issue: when I confirmed the delete-dialog, a red x showed up in the top right corner, but the dialog stays and the page is not deleted.

The xhr-request results in a status code 200 with the following response body:

{
    "ok":false,
    "error":"`git --git-dir=repo/.git --work-tree=repo rm firewall.md` failed with code 1"
}

There is also no error message as to why the delete operation was not successful.

The git-command when executed via the terminal has in turn the following error message:

$ git --git-dir=repo/.git --work-tree=repo rm firewall.md
error: the following file has changes staged in the index:
    firewall.md
(use --cached to keep the file, or -f to force removal)

It means that there are uncommitted changes in the git repo.

Explanation

This is linked to the fact that I did not configure a git repository as a backup. While commits should be made anyways when creating or editing a wiki page, I see that this is a problem because git wants you to set your account's default identity, before letting you commit. Thus, changes are made but not committed.

Possible Solution

This could be solved by deferring the git init command for when the user actually wants to configure a git integration.

tautf commented 5 years ago

I have the same issue without having a git repo configured. Is there any workaround to delete a page?

NGPixel commented 5 years ago

@FlonTaut Delete the page from ./repo and restart wiki.js

nhonx commented 5 years ago

I think we should fix by make system call the command "git --git-dir=repo/.git --work-tree=repo rm firewall.md" with "-f" to force delete page when we didn't config for git repo