grav-plugin-admin icon indicating copy to clipboard operation
grav-plugin-admin copied to clipboard

Multilanguage: UI broken after saving page + file extension broken when saving page in second language: default.md.fr.md

Open pamtbaau opened this issue 3 years ago • 12 comments

When saving a new page in a multi-lingual site, the Admin UI is broken.

Steps to reproduce:

  • Create a fresh install from zip with Grav 1.7.33. + Admin

  • Open Admin

  • Create new page and save: All is well Untitled

  • Add languages en and fr in Configuration panel

  • Create new page and save: Faulty page layout Untitled

  • Save current page as second language: Page throws error Untitled

  • Inspect the filesystem: Faulty file extension

    user/pages/
    ├── 01.home
    │   └── default.md
    ├── 02.typography
    │   └── default.md
    ├── 03.pageone
    │   └── default.md
    └── 04.pagetwo
        ├── default.en.md
        └── default.md.fr.md         <-- Note the file extension
    

pamtbaau avatar May 18 '22 06:05 pamtbaau

Perhaps this is caused by an outdated version of the Admin plugin. I'm running with v1.10.27 against Grav 1.7.33 and experiencing the same. @pamtbaau, what version of Admin are you experiencing this with?

Also saving a content item into another language (e.g. English item being saved as French) caused superfluous suffix added to the markdown file resulting in item.en.md.fr.md.

k8n avatar May 18 '22 20:05 k8n

I did my tests on a fresh install of the latest versions: Grav 1.7.33 + Admin 1.10.33.1.

This is weird. Created another fresh install and saving the page in the first language return a correct UI and saving the page in second language gives an error because of a faulty file extension: default.md.fr.md

I've update my initial post

pamtbaau avatar May 19 '22 03:05 pamtbaau

After some more tests, it seems to be a Grav core issue and not Admin.

  • Installed from zip latest Grav 1.7.33 + Admin
  • Downgraded Admin to earlier version
  • Admin shows issues

  • Installed from zip Grav 1.7.32 + Admin
  • All goes well
  • Upgraded Grav to 1.7.33 (not the plugins)
  • Admin shows issues

Looking at the changelog of Grav core, the following sound suspicious:

  1. When saving yaml and markdown, create also a cached version of the file and recompile it in opcache
  2. Fixed missing changes in yaml & markdown files if saved multiple times during the same second because of a caching issue

pamtbaau avatar May 19 '22 07:05 pamtbaau

@rhukster please help figure this out.

k8n avatar May 19 '22 13:05 k8n

I'm looking into this now. I am able to reproduce the issue, so I'm just trying to figure out what goes wrong.

mahagr avatar May 20 '22 10:05 mahagr

Clearing cache fixed the issue for me. Huh..

mahagr avatar May 20 '22 10:05 mahagr

Phew, that was a hard issue to track down. It's fixed now in CI!

mahagr avatar May 20 '22 12:05 mahagr

(Was fixed in Grav)

mahagr avatar May 20 '22 12:05 mahagr

Great! Something I can do to test?

pamtbaau avatar May 20 '22 12:05 pamtbaau

Looks like we didn't have CI builds available, lol. OK, so here's the fix:

https://github.com/getgrav/grav/commit/6fa96ca5545346cea152f2a748ada8950acba837#diff-c392650076318a0cca3f36706cc910159a2f35242ef8b7db4da2bcb61bad761dR141-R144

mahagr avatar May 20 '22 13:05 mahagr

Cloned branch 'develop' and ran above steps. All seems to be working well!

Thank you!

pamtbaau avatar May 20 '22 13:05 pamtbaau

Or that, lol.

mahagr avatar May 20 '22 13:05 mahagr