Skip to content

Commit

Permalink
Fix missing URI encoding of tag names
Browse files Browse the repository at this point in the history
The *tagged projects*, *tagged policies*, and *tagged alerts* dialogs would show an empty list for tags that contain special characters such as `/`.

This was caused by both DependencyTrack/dependency-track#4238, and tag names not being URI-encoded prior to using them as path parameters.

Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed Oct 10, 2024
1 parent 58f5231 commit 339f164
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/views/portfolio/tags/TagList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export default {
template: `
<div>
<b-link v-b-modal="\`taggedProjectListModal-${index}\`">{{ value }}</b-link>
<span v-if="error" class="fa fa-apple"></span>
<tagged-project-list-modal :tag="tagName" :index="index"/>
</div>`,
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
mixins: [permissionsMixin],
methods: {
apiUrl: function () {
return `${this.$api.BASE_URL}/${this.$api.URL_TAG}/${this.tag}/notificationRule`;
return `${this.$api.BASE_URL}/${this.$api.URL_TAG}/${encodeURIComponent(this.tag)}/notificationRule`;
},
untag: function (notificationRuleUuids) {
return this.axios.delete(this.apiUrl(), {
Expand Down
2 changes: 1 addition & 1 deletion src/views/portfolio/tags/TaggedPoliciesListModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
mixins: [permissionsMixin],
methods: {
apiUrl: function () {
return `${this.$api.BASE_URL}/${this.$api.URL_TAG}/${this.tag}/policy`;
return `${this.$api.BASE_URL}/${this.$api.URL_TAG}/${encodeURIComponent(this.tag)}/policy`;
},
untag: function (policyUuids) {
return this.axios.delete(this.apiUrl(), {
Expand Down
2 changes: 1 addition & 1 deletion src/views/portfolio/tags/TaggedProjectListModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
mixins: [bootstrapTableMixin, permissionsMixin],
methods: {
apiUrl: function () {
return `${this.$api.BASE_URL}/${this.$api.URL_TAG}/${this.tag}/project`;
return `${this.$api.BASE_URL}/${this.$api.URL_TAG}/${encodeURIComponent(this.tag)}/project`;
},
untag: function (projectUuids) {
return this.axios.delete(this.apiUrl(), {
Expand Down

0 comments on commit 339f164

Please sign in to comment.