Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update handling of permalink base-url setting #10775

Merged
merged 5 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/release-notes/permalink-base-urls.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 7 additions & 2 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,13 @@ 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:

- 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.

.. _dataverse.pid.*.handlenet:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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());

Expand Down
Loading