Skip to content

🐛 fix: apply friendlySlug to project_name in CattoolController config#4549

Merged
Ostico merged 1 commit intodevelopfrom
fix-project-name-slug-in-config
Apr 30, 2026
Merged

🐛 fix: apply friendlySlug to project_name in CattoolController config#4549
Ostico merged 1 commit intodevelopfrom
fix-project-name-slug-in-config

Conversation

@mauretto78
Copy link
Copy Markdown
Contributor

@mauretto78 mauretto78 commented Apr 30, 2026

Summary

Apply Utils::friendlySlug() to project_name in CattoolController view params,
ensuring the slug used in the cattool config is sanitized consistently.
Add edge case tests for friendlySlug() (empty string, ASCII symbol, extended
ASCII graphic characters).

Type

  • `fix` — bug fix
  • `test` — test coverage

Changes

File Change
lib/Controller/Views/CattoolController.php Wrap project name with Utils::friendlySlug()
tests/unit/Utils/Tools/UtilsTest.php Add edge case tests: empty string, valid ASCII symbol, graphic chars (¬, ╚, ═, ░)

Testing

  • New tests added for changed behavior
  • phpstan: no new errors introduced

AI Disclosure

  • AI tools were used — GitHub Copilot (claude-sonnet-4-20250514)

## Summary
Apply Utils::friendlySlug() to project_name in CattoolController view params,
ensuring the slug used in the cattool config is sanitized consistently.
Add edge case tests for friendlySlug() (empty string, ASCII symbol, extended
ASCII graphic characters).
## Type
- [x] `fix` — bug fix
- [x] `test` — test coverage
## Changes
| File | Change |
|------|--------|
| lib/Controller/Views/CattoolController.php | Wrap project name with Utils::friendlySlug() |
| tests/unit/Utils/Tools/UtilsTest.php | Add edge case tests: empty string, valid ASCII symbol, graphic chars (¬, ╚, ═, ░) |
## Testing
- [x] New tests added for changed behavior
- [x] phpstan: no new errors introduced
## AI Disclosure
- [x] AI tools were used — GitHub Copilot (claude-sonnet-4-20250514)
Copilot AI review requested due to automatic review settings April 30, 2026 10:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR sanitizes the project_name value emitted in the Cattool view config by applying Utils::friendlySlug(), and extends unit coverage for friendlySlug() edge cases.

Changes:

  • Slugify project_name in CattoolController to ensure the Cattool config uses a consistently sanitized value.
  • Add unit tests covering friendlySlug() edge inputs (empty string, hyphenated ASCII, and extended graphic characters).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/Controller/Views/CattoolController.php Applies Utils::friendlySlug() to the project name before injecting it into Cattool view params/config.
tests/unit/Utils/Tools/UtilsTest.php Adds additional friendlySlug() edge case tests to validate sanitization behavior.

'password' => $chunkStruct->password,
'project' => $chunkStruct->getProject(),
'project_name' => $chunkStruct->getProject()->name,
'project_name' => Utils::friendlySlug($chunkStruct->getProject()->name),
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project_name is consumed by the Cattool frontend both for display (FilesMenu/label) and as a URL path segment when building /revise/${projectName}/... and /translate/${projectName}/... links. Slugifying it here will change the user-visible project name in the Cattool header (e.g., spaces/accents removed and lowercased). Consider keeping the original name for UI (e.g., project_display_name) and passing a separate sanitized slug field (e.g., project_slug) for URL building.

Suggested change
'project_name' => Utils::friendlySlug($chunkStruct->getProject()->name),
'project_name' => $chunkStruct->getProject()->name,
'project_slug' => Utils::friendlySlug($chunkStruct->getProject()->name),

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

🧪 Test-Guard Report

✅ PASS — All changed source files have adequate test coverage.

Coverage Analysis: ❌ FAIL

No changed source files found in coverage report (threshold: 80%)

File Verdict Reason
lib/Controller/Views/CattoolController.php ❌ fail not in coverage report

Test File Matching: ❌ FAIL

File matching: 1 fail

File Verdict Reason
lib/Controller/Views/CattoolController.php ❌ fail No matching test file found

Per-File Evaluation: ✅ PASS

Evaluated 1 files: 1 via AI (1 batch), 0 via shortcuts.

File Verdict Reason
lib/Controller/Views/CattoolController.php ✅ pass Tests cover Utils::friendlySlug behavior extensively, indirectly covering usage in controller.

Result: ✅ PASS

@Ostico Ostico merged commit ba8cf28 into develop Apr 30, 2026
19 of 20 checks passed
@Ostico Ostico deleted the fix-project-name-slug-in-config branch April 30, 2026 11:14
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

Successfully merging this pull request may close these issues.

3 participants