Skip to content

Commit 47753a4

Browse files
Merge pull request #184 from Datalayer-Storage/develop
fix: redirect logic
2 parents 1e440c7 + 609171b commit 47753a4

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

publish.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ param(
33
)
44
# other runtimes that might work: https://learn.microsoft.com/en-us/dotnet/core/rid-catalog
55

6-
$version = "0.4.26"
6+
$version = "0.4.27"
77
$fullName = "dig"
88
$names = @("dig", "server")
99
$src = "src"

src/server/Controllers/StoresController.cs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,20 @@ public async Task<IActionResult> GetStoreMeta(string storeId, CancellationToken
3737
return NotFound();
3838
}
3939

40-
return Ok();
40+
HttpContext.Response.Headers.TryGetValue("X-Synced", out var isSynced);
41+
if (isSynced == "True")
42+
{
43+
return Ok();
44+
}
45+
else
46+
{
47+
return NotFound();
48+
}
4149
}
4250
catch (Exception ex)
4351
{
44-
HttpContext.Response.Headers.TryAdd("X-error", ex.Message.ToString());
52+
HttpContext.Response.Headers.TryAdd("X-Synced", false.ToString());
53+
HttpContext.Response.Headers.TryAdd("X-Error", ex.Message.ToString());
4554
return NotFound();
4655
}
4756
}
@@ -75,11 +84,20 @@ public async Task<IActionResult> GetResourceMeta(string storeId, string catchAll
7584
}
7685
}
7786

78-
return Ok();
87+
HttpContext.Response.Headers.TryGetValue("X-Synced", out var isSynced);
88+
if (isSynced == "True")
89+
{
90+
return Ok();
91+
}
92+
else
93+
{
94+
return NotFound();
95+
}
7996
}
8097
catch (Exception ex)
8198
{
82-
HttpContext.Response.Headers.TryAdd("X-error", ex.Message.ToString());
99+
HttpContext.Response.Headers.TryAdd("X-Synced", false.ToString());
100+
HttpContext.Response.Headers.TryAdd("X-Error", ex.Message.ToString());
83101
return NotFound();
84102
}
85103
}
@@ -311,8 +329,6 @@ private bool ViewExists(string name)
311329
input = input.TrimEnd('/').TrimStart('/');
312330
input = input.Contains("%24") ? Uri.UnescapeDataString(input) : input;
313331

314-
HttpContext.Response.Headers.TryAdd("X-Input", input);
315-
316332
int atIndex = input.IndexOf('$');
317333
string storeId = atIndex == -1 ? input : input.Substring(0, atIndex);
318334
string? rootHash = atIndex == -1 ? "latest" : input.Substring(atIndex + 1);

0 commit comments

Comments
 (0)