Fixes abstract file name filter
This commit is contained in:
@ -29,4 +29,4 @@ namespace Yavsc.Attributes.Validation
|
||||
return str.IsValidYavscPath();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Yavsc.ViewModels.UserFiles;
|
||||
|
||||
using System;
|
||||
|
||||
namespace Yavsc.Helpers
|
||||
{
|
||||
public static class AbstractFileSystemHelpers
|
||||
@ -50,7 +49,7 @@ namespace Yavsc.Helpers
|
||||
{
|
||||
if (ValidFileNameChars.Contains(c))
|
||||
sb.Append(c);
|
||||
else sb.Append('_');
|
||||
else sb.Append("#"+((int)c).ToString("D3"));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -71,7 +70,7 @@ namespace Yavsc.Helpers
|
||||
public const char RemoteDirectorySeparator = '/';
|
||||
|
||||
// Only accept descent remote file names
|
||||
public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. ".ToCharArray();
|
||||
public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. %#".ToCharArray();
|
||||
|
||||
// Estimate signature file name format
|
||||
public static Func<string,string,long,string>
|
||||
|
@ -1,5 +1,5 @@
|
||||
SOURCE_DIR=$(HOME)/workspace/yavsc
|
||||
MAKEFILE_DIR=$(SOURCE_DIR)/scripts/build/make
|
||||
|
||||
MAKEFILE_DIR=../../scripts/build/make
|
||||
BASERESX=Resources/Yavsc.Attributes.Validation.Resources.resx \
|
||||
Resources/Yavsc.Models.Messaging.Resources.resx \
|
||||
Resources/Yavsc.Models.IT.Fixing.Bug.resx\
|
||||
|
@ -48,26 +48,6 @@ deploy-pkg: publish
|
||||
|
||||
deploy: pushInPre pushInProd
|
||||
|
||||
pushInPre: cleanoutput bin/output/wwwroot/version
|
||||
sudo service kestrel-pre stop
|
||||
sudo rm -rf $(DESTDIR)/approot
|
||||
sudo cp -a bin/output/* $(DESTDIR)
|
||||
sudo cp ../../yavscd /usr/local/bin/yavscd-pre
|
||||
sudo sync
|
||||
sudo service kestrel-pre start
|
||||
|
||||
pushInProd: cleanoutput bin/output/wwwroot/version
|
||||
ifeq ($(git_status),0)
|
||||
sudo service kestrel stop
|
||||
sudo rm -rf $(PRODDESTDIR)/approot
|
||||
sudo cp -a bin/output/* $(PRODDESTDIR)
|
||||
sudo cp ../../yavscd /usr/local/bin/yavscd
|
||||
sudo sync
|
||||
sudo service kestrel start
|
||||
else
|
||||
$(error EPRODANDGITSTATUS! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.)
|
||||
endif
|
||||
|
||||
cleanPublish: pushInPre pushInProd
|
||||
rm -rf bin/output/
|
||||
|
||||
|
29
src/test/Mandatory/AbstractTests.cs
Normal file
29
src/test/Mandatory/AbstractTests.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Yavsc.Helpers;
|
||||
|
||||
namespace test
|
||||
{
|
||||
[Collection("Yavsc Abstract tests")]
|
||||
[Trait("regres", "no")]
|
||||
public class AbstractTests
|
||||
{
|
||||
ITestOutputHelper output;
|
||||
public AbstractTests(ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
}
|
||||
[Fact]
|
||||
public void UniquePathesAfterFileNameCleaning()
|
||||
{
|
||||
var name1 = "content:///scanned_files/2020-06-02/00.11.02.JPG";
|
||||
var name2 = "content:///scanned_files/2020-06-02/00.11.03.JPG";
|
||||
var cleanName1 = AbstractFileSystemHelpers.FilterFileName(name1);
|
||||
var cleanName2 = AbstractFileSystemHelpers.FilterFileName(name2);
|
||||
output.WriteLine($"{name1} => {cleanName1}");
|
||||
output.WriteLine($"{name2} => {cleanName2}");
|
||||
Assert.True(cleanName1 != cleanName2);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user