Skip to content

Commit 99be1a7

Browse files
author
Luis Cabrera
committed
We were not passing the token for the default data source.
We still need to consider what would happen if we want to preview files from different data sources though. This is a temporary fix for now.
1 parent f8b614d commit 99be1a7

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

02 - Web UI Template/CognitiveSearch.UI/Controllers/HomeController.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public IActionResult Search(string q)
6666
[HttpPost]
6767
public IActionResult GetDocuments(string q = "", SearchFacet[] searchFacets = null, int currentPage = 1)
6868
{
69-
GetContainerSasUris();
70-
69+
var tokens = GetContainerSasUris();
70+
7171
var selectFilter = _docSearch.Model.SelectFilter;
7272

7373
if (!string.IsNullOrEmpty(q))
@@ -114,6 +114,7 @@ public IActionResult GetDocuments(string q = "", SearchFacet[] searchFacets = nu
114114
Count = (response == null? 0 : Convert.ToInt32(response.Count)),
115115
SearchId = searchId,
116116
IdField = _idField,
117+
Token = tokens[0],
117118
IsPathBase64Encoded = _isPathBase64Encoded
118119
});
119120
}
@@ -255,7 +256,7 @@ private string GetToken(string decodedPath)
255256
/// This will return up to 3 tokens for the storage accounts
256257
/// </summary>
257258
/// <returns></returns>
258-
private void GetContainerSasUris()
259+
private string[] GetContainerSasUris()
259260
{
260261
if (tokens == null)
261262
{
@@ -285,6 +286,8 @@ private void GetContainerSasUris()
285286
CloudBlobContainer container3 = new CloudBlobContainer(new Uri(containerAddresses[2]), new StorageCredentials(accountName, accountKey));
286287
tokens[2] = container3.GetSharedAccessSignature(adHocPolicy, null);
287288
}
289+
290+
return tokens;
288291
}
289292

290293
[HttpPost]

02 - Web UI Template/CognitiveSearch.UI/wwwroot/js/results.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ function UpdateResults(data) {
3636

3737
// get path
3838
if (data.isPathBase64Encoded) {
39-
path = Base64Decode(result.metadata_storage_path);
39+
path = Base64Decode(result.metadata_storage_path) + token;
4040
}
4141
else {
42-
path = result.metadata_storage_path;
42+
path = result.metadata_storage_path + token;
4343
}
4444

4545
if (result["metadata_storage_name"] !== undefined) {

02 - Web UI Template/CognitiveSearch.UI/wwwroot/js/search.js

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var q, sortType, tempdata, instrumentationKey;
66
var results = [];
77
var facets = [];
88
var selectedFacets = [];
9+
var token = "";
910
var currentPage = 1;
1011
var searchId;
1112
var searchServiceName = "";
@@ -53,6 +54,7 @@ function Update(data) {
5354
results = data.results;
5455
facets = data.facets;
5556
tags = data.tags;
57+
token = data.token;
5658

5759
searchId = data.searchId;
5860

0 commit comments

Comments
 (0)