Remove gitea repo name restriction

This commit is contained in:
Yarmo Mackenbach 2023-01-18 13:56:37 +01:00
parent 1ffc8b4175
commit eb72827887
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1

View file

@ -15,7 +15,7 @@ limitations under the License.
*/ */
const E = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/(.*)\/(.*)\/gitea_proof\/?/ const reURI = /^https:\/\/(.*)\/(.*)\/(.*)\/?/
const processURI = (uri) => { const processURI = (uri) => {
const match = uri.match(reURI) const match = uri.match(reURI)
@ -41,7 +41,7 @@ const processURI = (uri) => {
access: E.ProofAccess.NOCORS, access: E.ProofAccess.NOCORS,
format: E.ProofFormat.JSON, format: E.ProofFormat.JSON,
data: { data: {
url: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`, url: `https://${match[1]}/api/v1/repos/${match[2]}/${match[3]}`,
format: E.ProofFormat.JSON format: E.ProofFormat.JSON
} }
} }
@ -65,6 +65,10 @@ const tests = [
}, },
{ {
uri: 'https://domain.org/alice/other_proof', uri: 'https://domain.org/alice/other_proof',
shouldMatch: true
},
{
uri: 'https://domain.org/alice',
shouldMatch: false shouldMatch: false
} }
] ]