fix: 301-redirect extensionless directory URLs to add trailing slash (#44) - #45
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On a Windows checkout (core.autocrlf=true, no .gitattributes) the shebang .mjs wrapper scripts get CRLF line endings. esbuild/vite's hashbang stripping then leaves an invalid token, so importing them from test/skill.test.ts fails the whole suite with "SyntaxError: Invalid or unexpected token" (CI on Linux is LF, so it never saw this). A CRLF shebang also breaks execution on Unix. Add `*.mjs text eol=lf` so these scripts are always LF regardless of the contributor's autocrlf. Once the suite collected, a second latent CRLF assumption surfaced: the SKILL.md frontmatter regex hard-coded `\n`, so it failed on the CRLF checkout. Make it line-ending agnostic (`\r?\n`). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
test/pack.test.ts spawned npm with execFileSync("npm", [...]), which throws
spawnSync ENOENT on Windows (the launcher is npm.cmd, and execFileSync does
not apply PATHEXT). Spawning npm.cmd directly is EINVAL since Node's
CVE-2024-27980 fix, and shell:true with an args array warns DEP0190. Use
execSync with a fixed literal command string: the shell resolves npm.cmd on
Windows and /bin/sh runs it on Linux/CI, with no deprecation noise.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cloudfront 모드로 배포한 폴더(멀티파일) 문서는 공유 링크에서 trailing slash가 빠지면 콘솔 에러 없는 흰 화면이 됐다. CloudFront Function이
/<code>(슬래시 없음)를 내부 rewrite로/<code>/index.html을 그대로 200 서빙해, 브라우저 주소가 슬래시 없이 남고index.html의 상대경로 자산./assets/...가 도메인 루트로 새어 403이 났다.이 PR은
infra/index-rewrite.js의 확장자-없음+슬래시-없음 분기를 내부 rewrite → 301 리다이렉트(/<code>→/<code>/, 쿼리스트링 보존)로 바꾼다. 정적 호스트의 표준 디렉터리 인덱스 동작이며, 최상위·중첩 경로에 균일하게 적용된다. 분기 순서(/_*→403, 트레일링 슬래시→index.html, 확장자 없음→301, 파일→통과)와_meta403 보호는 그대로다. s3-website 모드는 S3 네이티브 302 리다이렉트로 이미 정상이라 손대지 않았다.Fixes #44
포함된 부수 변경 (Windows CI 녹색화)
main기준에서 전체 스위트가 Windows에서 3건 실패(#44와 무관한 기존 이슈)라, 스위트를 녹색으로 되돌리기 위해 아래 2개 커밋을 cherry-pick했다(feat/41-self-hosted-mode에도 존재):.gitattributes에*.mjs text eol=lf+ skill 테스트 CRLF 허용 —.mjsshebang이 CRLF일 때 나는 SyntaxError 해결npm pack호출을execFileSync→execSync로 — Windows에서npm.cmd미해결(ENOENT) 해결Test plan
npx vitest run test/index-rewrite.test.ts— 11 passed (redirect 2 + 쿼리스트링 4 + 회귀 5)npm test— 217 passed / 3 skipped (전체 무회귀)npm run typecheck— 에러 없음npm run build—dist/생성 성공배포 주의사항
이 함수 수정은 코드만으로 기존 배포된 CloudFront distribution에 반영되지 않는다. 사용자가 최신 hostdoc으로 재-provision(
terraform apply) 해야 새 함수가 적용된다.🤖 Generated with Claude Code