From 638b4526a9fc1d797a028b5a77a4f2535d26fbba Mon Sep 17 00:00:00 2001 From: elffuss-bot Date: Fri, 2 Oct 2026 09:18:40 +0000 Subject: [PATCH] event 691 solution --- ...5e1966631ac1c5b83b998c6e02726aa1e513dae6fb | 67 +++++++++++++++++++ events/0000000691.json | 1 + 2 files changed, 68 insertions(+) create mode 100644 blobs/0x60408c3e513835d60476645e1966631ac1c5b83b998c6e02726aa1e513dae6fb create mode 100644 events/0000000691.json diff --git a/blobs/0x60408c3e513835d60476645e1966631ac1c5b83b998c6e02726aa1e513dae6fb b/blobs/0x60408c3e513835d60476645e1966631ac1c5b83b998c6e02726aa1e513dae6fb new file mode 100644 index 0000000..bc9b39e --- /dev/null +++ b/blobs/0x60408c3e513835d60476645e1966631ac1c5b83b998c6e02726aa1e513dae6fb @@ -0,0 +1,67 @@ +diff --git a/tests/acceptance/8/CRITERIA.json b/tests/acceptance/8/CRITERIA.json +new file mode 100644 +index 0000000000000000000000000000000000000000..f9e533a840985d6b12652889ed681903ba3dec14 +--- /dev/null ++++ b/tests/acceptance/8/CRITERIA.json +@@ -0,0 +1,18 @@ ++{ ++ "schema": "elffuss-t2t/criteria@2", ++ "issue": 8, ++ "criteria": [ ++ { ++ "index": 1, ++ "tests": [ ++ "tests/acceptance/8/criteria.test.js::criterion 1" ++ ] ++ }, ++ { ++ "index": 2, ++ "tests": [ ++ "tests/acceptance/8/criteria.test.js::criterion 2" ++ ] ++ } ++ ] ++} +diff --git a/tests/acceptance/8/criteria.test.js b/tests/acceptance/8/criteria.test.js +new file mode 100644 +index 0000000000000000000000000000000000000000..9f8fd3ab9c7020b2e9b3e372c7016e04ab1abdc7 +--- /dev/null ++++ b/tests/acceptance/8/criteria.test.js +@@ -0,0 +1,24 @@ ++import test from 'node:test'; ++import assert from 'node:assert/strict'; ++const mod = await import('../../../web/js/tools/clone.js'); ++ ++test('criterion 1', () => { ++ const result = mod.parseRepoUrl('https://' + 'github.com/o/r.git/'); ++ assert.equal(result.host, 'github'); ++ assert.equal(result.owner, 'o'); ++ assert.equal(result.repo, 'r'); ++ assert.equal(result.branch, null); ++ ++ const treeResult = mod.parseRepoUrl('https://' + 'github.com/o/r/tree/dev'); ++ assert.equal(treeResult.branch, 'dev'); ++}); ++ ++test('criterion 2', () => { ++ const result = mod.parseRepoUrl('https://' + 'bitbucket.org/o/r.git/'); ++ assert.equal(result.host, 'bitbucket'); ++ assert.equal(result.owner, 'o'); ++ assert.equal(result.repo, 'r'); ++ assert.equal(result.branch, null); ++ ++ assert.throws(() => mod.parseRepoUrl('https://' + 'example.org/o/r'), /URL no reconocida/); ++}); +diff --git a/web/js/tools/clone.js b/web/js/tools/clone.js +index 09ee334f934df2af3420147792b703d3e9f40209..78bf781095587319132a5c4832a2b56b72e234f4 100644 +--- a/web/js/tools/clone.js ++++ b/web/js/tools/clone.js +@@ -12,7 +12,7 @@ const MAX_FILE_BYTES = 4 * 1024 * 1024; // ficheros más grandes se saltan (bina + const CONCURRENCY = 10; + + export function parseRepoUrl(raw) { +- const url = String(raw || '').trim().replace(/\.git$/, '').replace(/\/+$/, ''); ++ const url = String(raw || '').trim().replace(/\/+$/, '').replace(/\.git$/, ''); + let m = url.match(/^(?:https?:\/\/)?(?:www\.)?github\.com\/([\w.-]+)\/([\w.-]+)(?:\/tree\/([\w./-]+))?/i); + if (m) return { host: 'github', owner: m[1], repo: m[2], branch: m[3] || null }; + m = url.match(/^(?:https?:\/\/)?(?:www\.)?bitbucket\.org\/([\w.-]+)\/([\w.-]+)(?:\/src\/([\w./-]+))?/i); diff --git a/events/0000000691.json b/events/0000000691.json new file mode 100644 index 0000000..5e4ef1b --- /dev/null +++ b/events/0000000691.json @@ -0,0 +1 @@ +{"data":{"cites":[],"envelope":{"delegation":{"identity":"0x780403ff413bee0512d807caef4d177bc3af7ebc","nonce":"1790932556","project":"0x0000000000000000000000000000000000000000000000000000000000000000","scopes":1,"sessionX":"0xcff3ed0744284a3db488bf1fc73b71a0f671362a1e30755e7d40614a494f433a","sessionY":"0x87b637a1c9ab2c56a165e3b0a60fda145f87a6959342967fdbc284a28c8aeb12","validFrom":"1790932496","validUntil":"1791105356"},"delegationSignature":"0x9ade4bb663df32c9991e77db0753a2c0c0d4bc220082dcf7ea53fdf502b3cb664b8654e6dc51881ce724631d0de2707cab2d2343be8c78ef9114e83cb1b66a3b1b","kind":"session","signature":"0x99df78b999711dac8f8fb22da3074c6909becfe2fc1a7ea7e422908bcc772ca65d27e0426689e97759912db4df13defdd568116701566c9d85fee4cb795ca789"},"mainHead":null,"message":{"author":"0x780403ff413bee0512d807caef4d177bc3af7ebc","baseCommit":"0x42a4a9a67cda0da050ec0e73e6294537cce1e541","basePartial":"0x0000000000000000000000000000000000000000000000000000000000000000","citesHash":"0x0000000000000000000000000000000000000000000000000000000000000000","issueId":"0xb39df7f42e2f2a5fe2272fbd62986ee6a0738e02391e5725f8b27a3a20f68b29","issuedAt":"1790932720","lines":2,"nonce":"1790932720349","patchHash":"0x60408c3e513835d60476645e1966631ac1c5b83b998c6e02726aa1e513dae6fb","project":"0x16d6e75341c5f21003a4d9e89b416a545f7335094d7df139fd20942c9b7fb2de","repo":"0xd822e541c0173492ca0725a08935bcd8eaa756a9559600a9427d0daac625ead2"},"pr":"elffuss/code:item/0x5132de138111e942d68923fb91f6674c2b0adf70fed8c5626a21ae2015c279a0"},"eventHash":"0x82458a2c3c061bb508f388e89b946ca6b92e1079237998045963d9ef7d3723a7","gatewaySignature":"0xb332f347d00a1d0ff497125c62f660fba2a265228dd193aff0db962959cfbd1b72c25b0538a59bb2b5a30ccdf56601b9f81ec8031a0979b85f235c4c7b2880991b","prev":"0x4e67ea1aeffccb3ec95d4a5e8ea07c16dc1b50f05a80867d2b2f262c40935763","seq":691,"ts":1790932720,"type":"solution","v":2}