Skip to content

Commit cc75775

Browse files
committed
Merge branch 'feature/fixIssueWithAlternateAppPrefix' into feature/addUserAgent
2 parents 7c3e3b9 + c21e78d commit cc75775

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

Aeon-ArchivesSpace-Addon/Aeon-ArchivesSpace.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,20 @@ local archiveSpaceAddonScript = [[
8383
var objectUrl = buildObjectUrl(objectId);
8484
atlasAddonAsync.executeAddonFunction('NodeChanged', currentRepositoryPath, objectUrl);
8585
86+
//Try to get the app_prefix to remove any additional web paths from the URL
87+
var appPrefix = "/";
88+
if (AS) {
89+
appPrefix = AS.app_prefix("");
90+
}
91+
8692
// This Injects the NodeChanged function into the Ajax callback that changes the record pages
8793
var originalAjaxThePane = AjaxTree.prototype._ajax_the_pane;
8894
AjaxTree.prototype._ajax_the_pane = function(url, params, callback) {
89-
atlasAddonAsync.executeAddonFunction('NodeChanged', currentRepositoryPath, url);
95+
//If the appPrefix is anything other than "/", replace it with just "/"
96+
var updateUrl = url.replace(appPrefix, "/");
97+
updateUrl.startsWith(updateUrl) ? updateUrl : "/" + updateUrl;
98+
atlasAddonAsync.executeAddonFunction('NodeChanged', currentRepositoryPath, updateUrl);
99+
//Preserve the original call using the original ASpace URL parameter
90100
originalAjaxThePane.call(this, url, params, callback);
91101
};
92102
}
@@ -752,7 +762,7 @@ function SendApiRequest(apiPath, method, parameters, authToken)
752762
LogDebug('apiPath: ' .. apiPath);
753763

754764
local webClient = types["System.Net.WebClient"]();
755-
765+
webClient.Encoding = Types["System.Text.Encoding"].UTF8;
756766
webClient.Headers:Clear();
757767
-- Add a user-agent for the API request to support ArchivesSpace API hosted by Lyrasis
758768
webClient.Headers:Add("user-agent", "AtlasAeon/" .. Version());

Readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Aeon ArchivesSpace Client Addon
22

33
## Version
4+
5+
- 3.0.1:
6+
- A UserAgent HTTP Header is sent in API calls to better support ArchivesSapces hosted by Lyrasis.
7+
- Better support for ArchivesSpace LibraryHost instances where the AppPrefix is not standard.
8+
- Set API to use UTF8 for ArchivesSpace API requests
49
- 3.0:
510
- Added support for embedded WebView2 browser. The addon will use this browser if it is available (Aeon 5.2+), and will use the embedded Chromium browser otherwise.
611
- 2.1:

0 commit comments

Comments
 (0)