Skip to content

Commit b9cc0f8

Browse files
committed
Fix encoding of VC ID while deleting
1 parent 1fe700e commit b9cc0f8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

web/src/admin/IdentityDetails.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
import DiscoveryServiceDefinition from "./DiscoveryServiceDefinition";
117117
import ErrorMessage from "../components/ErrorMessage.vue";
118118
import UploadCredential from "./credentials/UploadCredential.vue";
119+
import encodeURIPath from "../lib/encode.js"
119120
120121
export default {
121122
components: {ErrorMessage, UploadCredential},
@@ -178,7 +179,7 @@ export default {
178179
return
179180
}
180181
this.fetchError = undefined
181-
this.$api.delete(`api/proxy/internal/vcr/v2/holder/${encodeURIComponent(this.$route.params.subjectID)}/vc/${encodeURIComponent(credentialId)}`)
182+
this.$api.delete(`api/proxy/internal/vcr/v2/holder/${encodeURIPath(this.$route.params.subjectID)}/vc/${encodeURIPath(credentialId)}`)
182183
.then(data => {
183184
if (data.reason) {
184185
this.fetchError = data.reason

web/src/lib/encode.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
// encodeURIPath is like encodeURI, but does not encode :
3+
// Reason for this, is that Verifiable Credential IDs (VC IDs) are URIs that contain colons, which don't need to be encoded in URI paths,
4+
// but are encoded by encodeURI. This breaks API usage in Go, because Echo (or Go's HTTP package) does not decode the colons in the path, leading to 404 errors when trying to access VC IDs
5+
encodeURIPath: (path) => encodeURI(path).replace(/%3A/g, ':')
6+
}

0 commit comments

Comments
 (0)