From 0ccde224435ba0567b1f09f2e7e169fc47993b65 Mon Sep 17 00:00:00 2001 From: Vera Clemens Date: Wed, 14 Aug 2024 15:50:22 +0200 Subject: [PATCH 1/4] change permalink PID base url handling --- .../iq/dataverse/pidproviders/perma/PermaLinkPidProvider.java | 2 +- .../pidproviders/perma/PermaLinkProviderFactory.java | 2 +- .../edu/harvard/iq/dataverse/pidproviders/PidUtilTest.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/pidproviders/perma/PermaLinkPidProvider.java b/src/main/java/edu/harvard/iq/dataverse/pidproviders/perma/PermaLinkPidProvider.java index 91c7f527c88..7b55292350f 100644 --- a/src/main/java/edu/harvard/iq/dataverse/pidproviders/perma/PermaLinkPidProvider.java +++ b/src/main/java/edu/harvard/iq/dataverse/pidproviders/perma/PermaLinkPidProvider.java @@ -182,7 +182,7 @@ public GlobalId parsePersistentId(String protocol, String authority, String iden @Override public String getUrlPrefix() { - return getBaseUrl() + "/citation?persistentId=" + PERMA_PROTOCOL + ":"; + return getBaseUrl(); } @Override diff --git a/src/main/java/edu/harvard/iq/dataverse/pidproviders/perma/PermaLinkProviderFactory.java b/src/main/java/edu/harvard/iq/dataverse/pidproviders/perma/PermaLinkProviderFactory.java index 32b89223062..ca75fbff3a8 100644 --- a/src/main/java/edu/harvard/iq/dataverse/pidproviders/perma/PermaLinkProviderFactory.java +++ b/src/main/java/edu/harvard/iq/dataverse/pidproviders/perma/PermaLinkProviderFactory.java @@ -28,7 +28,7 @@ public PidProvider createPidProvider(String providerId) { String excludedList = JvmSettings.PID_PROVIDER_EXCLUDED_LIST.lookupOptional(providerId).orElse(""); String baseUrl = JvmSettings.PERMALINK_BASE_URL.lookupOptional(providerId) - .orElse(SystemConfig.getDataverseSiteUrlStatic()); + .orElse(SystemConfig.getDataverseSiteUrlStatic() + "/citation?persistentId=" + PermaLinkPidProvider.PERMA_PROTOCOL + ":"); ; String separator = JvmSettings.PERMALINK_SEPARATOR.lookupOptional(providerId).orElse(""); diff --git a/src/test/java/edu/harvard/iq/dataverse/pidproviders/PidUtilTest.java b/src/test/java/edu/harvard/iq/dataverse/pidproviders/PidUtilTest.java index cffac741c78..e36312edc8a 100644 --- a/src/test/java/edu/harvard/iq/dataverse/pidproviders/PidUtilTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/pidproviders/PidUtilTest.java @@ -67,7 +67,7 @@ @JvmSetting(key = JvmSettings.PID_PROVIDER_SHOULDER, value = "QE", varArgs = "perma2") @JvmSetting(key = JvmSettings.PID_PROVIDER_MANAGED_LIST, value = "perma:LINKIT/FK2ABCDEF", varArgs ="perma2") @JvmSetting(key = JvmSettings.PERMALINK_SEPARATOR, value = "/", varArgs = "perma2") -@JvmSetting(key = JvmSettings.PERMALINK_BASE_URL, value = "https://example.org/123", varArgs = "perma2") +@JvmSetting(key = JvmSettings.PERMALINK_BASE_URL, value = "https://example.org/123/citation?persistentId=perma:", varArgs = "perma2") // Datacite 1 @JvmSetting(key = JvmSettings.PID_PROVIDER_LABEL, value = "dataCite 1", varArgs = "dc1") @JvmSetting(key = JvmSettings.PID_PROVIDER_TYPE, value = DataCiteDOIProvider.TYPE, varArgs = "dc1") @@ -191,7 +191,7 @@ public void testFactories() throws IOException { assertEquals("-", p.getSeparator()); assertTrue(p.getUrlPrefix().startsWith(SystemConfig.getDataverseSiteUrlStatic())); p = PidUtil.getPidProvider("perma2"); - assertTrue(p.getUrlPrefix().startsWith("https://example.org/123")); + assertTrue(p.getUrlPrefix().startsWith("https://example.org/123/citation?persistentId=")); p = PidUtil.getPidProvider("dc2"); assertEquals("FK3", p.getShoulder()); From 0e90523b57eb038d6bb979705f20cce991cd86ff Mon Sep 17 00:00:00 2001 From: Vera Clemens Date: Thu, 15 Aug 2024 14:12:08 +0200 Subject: [PATCH 2/4] docs: add warning about special characters in PermaLink authority/shoulder values --- doc/sphinx-guides/source/installation/config.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/sphinx-guides/source/installation/config.rst b/doc/sphinx-guides/source/installation/config.rst index ae3b07fecfe..ceec5f1a9b6 100644 --- a/doc/sphinx-guides/source/installation/config.rst +++ b/doc/sphinx-guides/source/installation/config.rst @@ -532,8 +532,12 @@ dataverse.pid.*.permalink.separator ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PermaLinks are a simple PID option intended for intranet and catalog use cases. They can be used without an external service or -be configured with the ``base-url`` of a resolution service. PermaLinks also allow a custom ``separator`` to be used. (Note: when using multiple -PermaLink providers, you should avoid ambiguous authority/separator/shoulder combinations that would result in the same overall prefix.) +be configured with the ``base-url`` of a resolution service. PermaLinks also allow a custom ``separator`` to be used. + +Note: + +- When using multiple PermaLink providers, you should avoid ambiguous authority/separator/shoulder combinations that would result in the same overall prefix. +- In general, PermaLink authority/shoulder values should be alphanumeric. For other cases, admins may need to consider the potential impact of special characters in S3 storage identifiers, resolver URLs, exports, etc. .. _dataverse.pid.*.handlenet: From 3e33e68d3e32285398f41f3abecf24ac2b0852b1 Mon Sep 17 00:00:00 2001 From: Vera Clemens Date: Thu, 15 Aug 2024 14:13:00 +0200 Subject: [PATCH 3/4] docs: add release note for changed permalink PID base url handling --- doc/release-notes/permalink-base-urls.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doc/release-notes/permalink-base-urls.md diff --git a/doc/release-notes/permalink-base-urls.md b/doc/release-notes/permalink-base-urls.md new file mode 100644 index 00000000000..1dd74057351 --- /dev/null +++ b/doc/release-notes/permalink-base-urls.md @@ -0,0 +1,10 @@ +The configuration setting `dataverse.pid.*.permalink.base-url`, which is used for PermaLinks, has been updated to +support greater flexibility. Previously, the string "/citation?persistentId=" was automatically appended to the +configured base URL. With this update, the base URL will now be used exactly as configured, without any automatic +additions. + +**Upgrade instructions:** + +- If you currently use a PermaLink provider with a configured `base-url`: You must manually append + "/citation?persistentId=" to the existing base URL to maintain functionality. +- If you use a PermaLink provider without a configured `base-url`: No changes are required. \ No newline at end of file From d76556ab422d48ca0044f7be1a67722f4f420a0d Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Mon, 16 Sep 2024 16:35:20 -0400 Subject: [PATCH 4/4] add trailing / after hostname for perma base-url #10775 --- doc/sphinx-guides/source/installation/config.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/sphinx-guides/source/installation/config.rst b/doc/sphinx-guides/source/installation/config.rst index 1a09e575cdc..2f4a605260c 100644 --- a/doc/sphinx-guides/source/installation/config.rst +++ b/doc/sphinx-guides/source/installation/config.rst @@ -536,6 +536,7 @@ be configured with the ``base-url`` of a resolution service. PermaLinks also all Note: +- If you configure ``base-url``, it should include a "/" after the hostname like this: ``https://demo.dataverse.org/``. - When using multiple PermaLink providers, you should avoid ambiguous authority/separator/shoulder combinations that would result in the same overall prefix. - In general, PermaLink authority/shoulder values should be alphanumeric. For other cases, admins may need to consider the potential impact of special characters in S3 storage identifiers, resolver URLs, exports, etc.