Skip to content

Commit

Permalink
Fix: Remove unwanted leading/trailing whitespaces in attributions (#4066
Browse files Browse the repository at this point in the history
)
  • Loading branch information
andrewscwei authored Apr 11, 2024
1 parent 68f3a7a commit 12e5b9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/VMediaInfo/VCopyLicense.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
:media-id="media.id"
:media-type="media.frontendMediaType"
>
<p id="attribution-html" class="break-all font-mono" dir="ltr">
{{ getAttributionMarkup() }}
</p>
<!-- Ignore reason: the interpolated string cannot have any whitespace around it when inside <p>, else there will be unwanted whitespace -->
<!-- prettier-ignore -->
<p id="attribution-html" class="break-all font-mono" dir="ltr">{{ getAttributionMarkup() }}</p>
</VLicenseTabPanel>
<VLicenseTabPanel
:tab="tabs[2]"
:media-id="media.id"
:media-type="media.frontendMediaType"
>
{{ getAttributionMarkup({ isPlaintext: true }) }}
<p>{{ getAttributionMarkup({ isPlaintext: true }) }}</p>
</VLicenseTabPanel>
</VTabs>
</div>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/utils/attribution-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ export const getAttribution = (
})
}

const attribution = tFn("text", attributionParts).replace(/\s{2}/g, " ")
const attribution = tFn("text", attributionParts)
.replace(/\s{2}/g, " ")
.trim()

return isPlaintext
? attribution
Expand Down

0 comments on commit 12e5b9d

Please sign in to comment.