Giter Club home page Giter Club logo

Comments (5)

jakelumetta avatar jakelumetta commented on June 5, 2024

Thanks @dabrorius ! You're right, that should return a NotFound. @hcatlin any suggestion on how to deal with # or other invalid characters passed in as the slug?

That said - # is not a valid character in post slugs so could you strip them out on your end before calling the API in the short term?

from buttercms-ruby.

HamptonMakes avatar HamptonMakes commented on June 5, 2024

@jakelumetta is there an official list of slug format rules? Like a regexp?

@dabrorius yeah, this was us at @veuelive trying to help get rid of deprecation warnings that would break this in Ruby 3.0! Was this just kind of strange data making it in or did you all use "#" named slugs with the encoding as a feature? Is the 404 important to your logic, or is rejecting it via a format error more in-line with your needs?

from buttercms-ruby.

jakelumetta avatar jakelumetta commented on June 5, 2024

@hcatlin typical slugification rules: should be lowercase alphanumeric and also supports dashes

My Favorite #Post -> my-favorite-post

from buttercms-ruby.

dabrorius avatar dabrorius commented on June 5, 2024

Thanks for the reply! We don't use # in the slugs, however what we did was pass the param containing the slug from our Rails route directly to the ButterCMS API and relied on catching the ButterCMS::NotFound error to handle invalid slugs.

After an unrelated issue on our side, some users ended up accessing invalid routes that included # in the slug and that's how we caught this error. We can do the sanitation of slugs on our side but I wanted to share the issue with your team.

from buttercms-ruby.

jakelumetta avatar jakelumetta commented on June 5, 2024

Thanks @dabrorius ! Going to close this issue for now but thanks for the heads up. We may consider adding more cleaning logic to the SDK in the future.

from buttercms-ruby.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.