Skip to content

Commit ba6b585

Browse files
authored
fix: don't show Not Found error when package name includes / (#439)
<img width="1288" alt="image" src="https://github.com/jsr-io/jsr/assets/7829205/47ce450c-f324-49c7-a8ce-08a9af2cd9c2"> Fixes #437
1 parent ddcb541 commit ba6b585

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

frontend/islands/new.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ export function PackageName(
223223
const message = useComputed(() => {
224224
if (error.value) return error.value;
225225
if (name.value.length === 0) return "";
226+
if (name.value.startsWith("@")) {
227+
return "Enter only the package name, do not include the scope.";
228+
}
226229
if (name.value.length > 32) {
227230
return "Package name cannot be longer than 32 characters.";
228231
}
@@ -239,8 +242,9 @@ export function PackageName(
239242
const scope_ = scope.value;
240243
const newName = name.value;
241244
if (
242-
scope_ === "" || newName.length < 2 || scope_.includes("_") ||
243-
newName.includes("_")
245+
scope_ === "" || newName.length < 2 ||
246+
!/^[a-z0-9][a-z0-9\-]+$/.test(scope_) ||
247+
!/^[a-z0-9][a-z0-9\-]+$/.test(newName)
244248
) {
245249
pkg.value = undefined;
246250
return;

0 commit comments

Comments
 (0)