Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
deploy:
name: Deploy Worker
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
pull_request:

permissions:
contents: read

jobs:
test:
name: Run Tests
Expand Down
26 changes: 14 additions & 12 deletions cloudflare-worker/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,23 +697,25 @@ export default {
return new Response("Invalid Request", { status: 400 });
} catch (rawError) {
console.error("Webhook processing failed:", rawError);
let error;

let name = "Error";
let message;

if (rawError instanceof Error) {
error = rawError;
name = rawError.name;
message = rawError.message;
} else if (rawError && typeof rawError === 'object') {
name = String(rawError.name || "Error");
message = String(rawError.message || rawError);
} else if (rawError !== undefined && rawError !== null) {
message = String(rawError);
} else {
const msg = rawError && typeof rawError === 'object' && rawError.message
? String(rawError.message)
: String(rawError);
error = new Error(msg);
if (rawError && typeof rawError === 'object') {
error.name = rawError.name || error.name;
error.stack = rawError.stack || error.stack;
}
message = "null";
}

const errorDetails = {
name: error.name || "Error",
message: error.message || String(error),
name,
message,
timestamp: Date.now()
};
return new Response(JSON.stringify({
Expand Down
2 changes: 1 addition & 1 deletion cloudflare-worker/src/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function isNoreplyEmail(email) {
export function getNormalizedText(str, pkgName) {
let cleaned = str.toLowerCase();
if (pkgName) {
cleaned = cleaned.replace(new RegExp(pkgName.toLowerCase(), 'g'), '');
cleaned = cleaned.replaceAll(pkgName.toLowerCase(), '');
}
// Remove common list bullet markers and generic words
cleaned = cleaned.replace(/^[\s\-*+•#]+/, '');
Expand Down