Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Fix: Remove unwanted leading/trailing whitespaces in attributions (#4066)
Andrew Wei12e5b9d18c45
diff --git a/frontend/src/components/VMediaInfo/VCopyLicense.vue b/frontend/src/components/VMediaInfo/VCopyLicense.vueindex 7c7acd59a..66be71afd 100644--- a/frontend/src/components/VMediaInfo/VCopyLicense.vue+++ b/frontend/src/components/VMediaInfo/VCopyLicense.vue@@ -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>diff --git a/frontend/src/utils/attribution-html.ts b/frontend/src/utils/attribution-html.tsindex d40f72e4b..106d3b67b 100644--- a/frontend/src/utils/attribution-html.ts+++ b/frontend/src/utils/attribution-html.ts@@ -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