Skip to content

Commit

Permalink
Fix: Stop validation error on upload,
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Sep 12, 2023
1 parent c629589 commit d6908a8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions uSync.BackOffice/Services/SyncFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public List<string> VerifyFolder(string folder, string extension)
if (!DirectoryExists(resolvedFolder))
throw new DirectoryNotFoundException(folder);

var keys = new Dictionary<Guid, string>();
var keys = new Dictionary<string, string>();
var errors = new List<string>();

var files = Directory.GetFiles(resolvedFolder, $"*.{extension}", SearchOption.AllDirectories)
Expand All @@ -411,18 +411,21 @@ public List<string> VerifyFolder(string folder, string extension)

if (!node.IsEmptyItem())
{
var key = node.GetKey();
// make the key unique for the type, then we don't get false
// positives when different bits share ids (like PublicAccess and Content)

var key = $"{node.Name.LocalName}_{node.GetKey()}";
var folderName = Path.GetFileName(Path.GetDirectoryName(file));
var filename = Path.GetFileName(file);
var filepath = GetShortFileName(file);
var filePath = GetShortFileName(file);

if (!keys.ContainsKey(key))
{
keys[key] = filepath;
keys[key] = filePath;
}
else
{
errors.Add($"Clash {filepath} shares an id with {keys[key]}");
errors.Add($"Clash {filePath} shares an id with {keys[key]}");
}
}
}
Expand Down

0 comments on commit d6908a8

Please sign in to comment.