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

Slug generation breaks when the first part of entry name is uppercase #4295

Closed
RoseDMH opened this issue May 22, 2019 · 2 comments
Closed

Slug generation breaks when the first part of entry name is uppercase #4295

RoseDMH opened this issue May 22, 2019 · 2 comments

Comments

@RoseDMH
Copy link

RoseDMH commented May 22, 2019

Description

SIMILAR to #4266, possibly related.

When the entry title is in the format UPPERCASElowercase (for example "VAPORwave") a hyphen is added to the slug before the last uppercase letter, even if there are no spaces at all in the original string (so the previous example would become "vapo-rwave" in the slug).

Steps to reproduce

  1. Create an entry with a title that has an uppercase portion and a lowercase portion, in that order, with no spaces.
    2.Save the entry and check the automatically generated slug. A hyphen should appear between the final and the penultimate letter of the uppercase portion.

Additional info

  • Craft version:Craft Pro 3.1.28
  • PHP version:7.3.1
  • Database driver & version:MySQL 5.5.5
@RoseDMH RoseDMH changed the title Slug generation Slug generation breaks when the first part of entry name is uppercase May 22, 2019
@brandonkelly
Copy link
Member

That is expected behavior. Craft is interpreting this as an uppercase word (VAPO) followed by a camel-cased word (Rwave), which is generally a safe assumption with strings like this. (For example, see the oldHTMLFile example in the Camel Case Wikipedia entry.)

@terryupton
Copy link

terryupton commented May 28, 2019

Also perhaps related to the above and #4266 - I am seeing the following:
My title field is setup as follows {hotTubName}{stockCode} and then when I enter the following into the Stock Code field: 18T1018 it is creating the slug as follows:
sundance18-t1018 - I wouldn't expect this behaviour, I would expect the slug to be sundance18t1018

For now I have changed my title field to {hotTubName}-{stockCode|lower}

Thanks.

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

3 participants