TryGhost / Ghost

Independent technology for modern publishing, memberships, subscriptions and newsletters.
https://ghost.org
MIT License
47.04k stars 10.24k forks source link

Import error message for slug too long even though it is below 191 characters #10043

Closed utrenkner closed 5 years ago

utrenkner commented 5 years ago

I am currently test-importing almost 30 000 articles from an old CMS. I already included a shortening routine, cutting long slugs to 190 characters at most (defensively staying 1 character below the stated limit of 191).

However, the slug photovoltaik-gebaeudeintegration-heliatek-und-reckli-unterzeichnen-entwicklungsvereinbarung-zur-integration-organischer-solarmodule-in-gebaeudefassaden-aus-beton-markteinfuehrung-in----18525 is 190 characters long, and produces the following error-message when importing:

Import failed
Value in [posts.slug] exceeds maximum length of 191 characters.

{"uuid":"17811383-5e9c-44fe-ad5f-1a2db60f9b51","title":"Photovoltaik-Gebäudeintegration: Heliatek und RECKLI unterzeichnen Entwicklungsvereinbarung zur Integration organischer Solarmodule in Gebäudefassaden aus Beton; Markteinführung in zwei Jahren geplant","slug":"photovoltaik-gebaeudeintegration-heliatek-und-reckli-unterzeichnen-entwicklungsvereinbarung-zur-integration-organischer-solarmodule-in-gebaeudefassaden-aus-beton-markteinfuehrung-in----18525","mobiledoc":"...

To me it looks like the error message (191 characters) is wrong.

Now, I will go back to testing where the real limit is...

utrenkner commented 5 years ago

OK, I found the cause of the problem. And I don't think it's an important issue and I therefore close this issue: I had problems with the massive upload. That led me to re-importing parts of the import. But Ghost automatically adds -2, -3 etc. to the slug of the second, third etc. version of the same slug. Of course, this adds at least two characters.

Issue #9251 kind of solves the same issue when writing/saving posts.