Comments (5)
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.
@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.
@hcatlin typical slugification rules: should be lowercase alphanumeric and also supports dashes
My Favorite #Post -> my-favorite-post
from buttercms-ruby.
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.
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)
- fields.headline is not a valid hash key HOT 1
- ButterCollection cannot be correctly marshal loaded because of dynamic method generation HOT 5
- Errors in Pages Ruby Code HOT 5
- Ruby 2.7 Warnings HOT 3
- map() Error HOT 2
- ButterCMS::Post.all method does not return all posts if the page_size param is 20 and preview is set HOT 1
- Please use semantic versioning or at least add a changelog HOT 3
- Post.find("invalid_id") returns invalid Post HOT 2
- Unable to iterate over paginated ButterCMS::Content HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buttercms-ruby.