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

Deleting page with language code doesn't delete the folder #3305

Closed
Ribero opened this issue Jan 21, 2021 · 10 comments
Closed

Deleting page with language code doesn't delete the folder #3305

Ribero opened this issue Jan 21, 2021 · 10 comments
Assignees

Comments

@Ribero
Copy link

Ribero commented Jan 21, 2021

Grav v1.7.1 - Admin v1.10.1

  • add a new page in /root using Admin Panel GUI and select visible to yes in the dialog box
  • save the page
  • go back to Admin Panel
  • Open the page
  • Change status of page from Published=Yes (default) to Published = No -> the page is then marked as non published and you can verify it on the site
  • Save & go back to Admin Panel
  • From Admin Panel GUI select the page and delete it:

image

You first see that even if the page has the red dot (not published) the menu shows the contrary (green label Published)

  • select delete
  • The delete is confirmed by the message "Directory Entry removed successfully"
  • but you will see it is not deleted:

image

  • You will also see that the page as now has a green dot (published) and you can effectively see it's entry on the site menu but you will get a 404 if you click it
  • from Admin Panel, You can then try a second delete and this time the page will be deleted and the web site menu updated.
@mahagr mahagr self-assigned this Jan 21, 2021
@mahagr
Copy link
Member

mahagr commented Jan 21, 2021

What happens is that the page gets deleted, but the folder remains. This causes the page to become a folder, so what you see is expected.

I think this happens only with multi-language functionality turned on, it somehow fails to detect that the page does not exist in any language.

@beamaria
Copy link

beamaria commented Jan 22, 2021

Same problem with me with a bilingual site (english /irish) Also I've just opened a new issue #3214 for a strange behaviour in pages (admin) display... maybe that issue too is related to multi-language functionality

@mahagr
Copy link
Member

mahagr commented Feb 9, 2021

I think that this has already been fixed while fixing another issue. As I cannot reproduce it anymore.

@realyussel
Copy link

I have a same problem, with a site only in spanish.

@mahagr
Copy link
Member

mahagr commented Feb 16, 2021

I hope this will be fixed after the next release goes out.

@mahagr
Copy link
Member

mahagr commented Mar 4, 2021

Should be fixed?

@Eihrister
Copy link
Contributor

Hello!

I ran into this issue earlier, but whether or not a page is Published does not matter.

I have a multilingual site, and it seems that if the last language file (default.en.md for instance) in the directory has been deleted, it fails to detect that it was the last file, and thus does not clean up the directory/folder that's left behind. The name shown in the admin panel then becomes the slug (directory name). Deleting it again does remove the entry, because then it sees the directory is empty.

Whether it's deleted from the Pages view or clicking the Delete button when having the specific page open, does not make any difference. Cache on or off also makes no difference. Leaving 1 single language configured or having 4 (en, nl, pt, and es in my case) does not matter either.

The main issue seems to be:

Failure to detect that the directory/folder is empty after deleting the last remaining language-specific file (default.XX.md, for instance), which results in not cleaning it up after.

@mahagr
Copy link
Member

mahagr commented Apr 9, 2021

You're right. I just checked and the delete only deletes the current language unless you delete the "languageless" version of the page.

@mahagr mahagr changed the title Cannot delete a page that is Published=No Deleting page with language code doesn't delete the folder Apr 9, 2021
@mahagr mahagr transferred this issue from getgrav/grav-plugin-admin Apr 9, 2021
@mahagr mahagr added the bug label Apr 9, 2021
mahagr added a commit that referenced this issue Apr 9, 2021
@mahagr mahagr added the fixed label Apr 9, 2021
@mahagr
Copy link
Member

mahagr commented Apr 9, 2021

This will be fixed to the next release.

@mahagr
Copy link
Member

mahagr commented Apr 9, 2021

The logic now works in this way:

  1. Attempting to delete the page without language code (en.md, fi.md etc) will always delete the folder
  2. If you delete a language-specific page, it will not delete the folder unless it was the last markdown file in that folder

We should probably improve the modal to allow user to choose what he wants to do.

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

No branches or pull requests

5 participants