Skip to content

Commit

Permalink
fix: slug URL field validation and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Nov 20, 2023
1 parent 85c9ee5 commit 721def2
Show file tree
Hide file tree
Showing 7 changed files with 574 additions and 523 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## v2.0.1 (2023-11-20)

- URL slugs now only accept alphanumeric characters along with dashes and underscores to ensure valid URL strings
- The post title is no longer slugified automatically to the URL when editing a post title. This ensures that existing links aren't broken without user intervention when updating a post title
- Bumps patch versions of dependencies

## v2.0.0 (2023-10-09)

- Image references are now stored in the database instead of losely through the filesystem. This means that tracking what images belong to what users and posts should work much smoother. Additionally, various improvements were made across the app to how images are handled resulting in a vastly improved image experience
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM justintime50/nginx-php:8.2-16
FROM justintime50/nginx-php:8.2-17

ARG PROD

Expand Down
2 changes: 2 additions & 0 deletions src/app/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public function create(Request $request): RedirectResponse
'title' => 'required|string',
'slug' => [
'required',
'alpha_dash:ascii',
Rule::unique('posts')->ignore($post->id)->where(function ($query) {
return $query->where('user_id', Auth::user()->id);
})
Expand Down Expand Up @@ -210,6 +211,7 @@ public function update(Request $request, int $id): RedirectResponse
'title' => 'required|string',
'slug' => [
'required',
'alpha_dash:ascii',
Rule::unique('posts')->ignore($post->id)->where(function ($query) {
return $query->where('user_id', Auth::user()->id);
})
Expand Down
Loading

0 comments on commit 721def2

Please sign in to comment.