Fixes abstract file name filter
This commit is contained in:
parent
8403798d4d
commit
b7fdf47529
9 changed files with 56 additions and 37 deletions
22
Makefile
22
Makefile
|
|
@ -5,6 +5,8 @@ DNXLIBS=Microsoft.Dnx.Host.Mono.dll Microsoft.Dnx.Host.dll Microsoft.Dnx.Applica
|
||||||
DNXLIBFP:=$(addprefix $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin/, $(DNXLIBS))
|
DNXLIBFP:=$(addprefix $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin/, $(DNXLIBS))
|
||||||
CONFIG=Debug
|
CONFIG=Debug
|
||||||
|
|
||||||
|
git_status := $(shell git status -s --porcelain |wc -l)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll
|
rm -f src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll
|
||||||
|
|
||||||
|
|
@ -17,11 +19,21 @@ test:
|
||||||
web:
|
web:
|
||||||
make -C src/Yavsc web
|
make -C src/Yavsc web
|
||||||
|
|
||||||
pushInProd:
|
pushInPre: yavscd
|
||||||
make -C src/Yavsc pushInProd
|
sudo service kestrel-pre stop
|
||||||
|
sudo cp yavscd /usr/local/bin/yavscd-pre
|
||||||
|
sudo sync
|
||||||
|
sudo service kestrel-pre start
|
||||||
|
|
||||||
pushInPre:
|
pushInProd: yavscd
|
||||||
make -C src/Yavsc pushInPre
|
ifeq ($(git_status),0)
|
||||||
|
sudo service kestrel stop
|
||||||
|
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
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
make -C src/Yavsc.Abstract pack
|
make -C src/Yavsc.Abstract pack
|
||||||
|
|
@ -49,7 +61,7 @@ src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll: src/Yavsc.Abstract/bin/$
|
||||||
src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll: src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll
|
src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll: src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll
|
||||||
make -C src/Yavsc CONFIGURATION=$(CONFIG)
|
make -C src/Yavsc CONFIGURATION=$(CONFIG)
|
||||||
|
|
||||||
bundle: src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll
|
yavscd: src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll
|
||||||
mkbundle --static $(DNXLIBS) src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/en/Yavsc.resources.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/en/Yavsc.Server.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/en/Yavsc.Abstract.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/pt/Yavsc.Abstract.resources.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll $(LIBS) -L $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin --machine-config $(MONO_PREFIX)/etc/mono/4.5/machine.config -o yavscd
|
mkbundle --static $(DNXLIBS) src/Yavsc/bin/$(CONFIG)/dnx451/Yavsc.dll src/Yavsc/bin/$(CONFIG)/dnx451/pt/Yavsc.resources.dll src/Yavsc/bin/$(CONFIG)/dnx451/en/Yavsc.resources.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/Yavsc.Server.dll src/Yavsc.Server/bin/$(CONFIG)/dnx451/en/Yavsc.Server.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/Yavsc.Abstract.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/en/Yavsc.Abstract.resources.dll src/Yavsc.Abstract/bin/$(CONFIG)/dnx451/pt/Yavsc.Abstract.resources.dll src/OAuth.AspNet.AuthServer/bin/$(CONFIG)/dnx451/OAuth.AspNet.AuthServer.dll src/OAuth.AspNet.Token/bin/$(CONFIG)/dnx451/OAuth.AspNet.Token.dll $(LIBS) -L $(DNX_USER_HOME)/runtimes/dnx-mono.1.0.0-rc1-update2/bin --machine-config $(MONO_PREFIX)/etc/mono/4.5/machine.config -o yavscd
|
||||||
strip yavscd
|
strip yavscd
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
# Common defs
|
# Common defs
|
||||||
# assumes SOLUTIONDIR already defined
|
|
||||||
#
|
#
|
||||||
|
|
||||||
ifndef PRJNAME
|
ifndef PRJNAME
|
||||||
|
|
@ -62,7 +61,7 @@ bin/output/wwwroot/version: bin/output
|
||||||
|
|
||||||
pack: $(NUGETSOURCE)/$(PKGFILENAME)
|
pack: $(NUGETSOURCE)/$(PKGFILENAME)
|
||||||
|
|
||||||
$(NUGETSOURCE)/$(PKGFILENAME): $(BINTARGETPATH) $(SOLUTIONDIR)/version.txt
|
$(NUGETSOURCE)/$(PKGFILENAME): $(BINTARGETPATH) ../../version.txt
|
||||||
ifeq ($(git_status),0)
|
ifeq ($(git_status),0)
|
||||||
nuget pack $(PRJNAME).nuspec -Version $(VERSION) -Properties config=$(CONFIGURATION) -OutputDirectory bin
|
nuget pack $(PRJNAME).nuspec -Version $(VERSION) -Properties config=$(CONFIGURATION) -OutputDirectory bin
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
ifndef PRJNAME
|
ifndef PRJNAME
|
||||||
PRJNAME := $(shell basename `pwd -P`)
|
PRJNAME := $(shell basename `pwd -P`)
|
||||||
endif
|
endif
|
||||||
SOLUTIONDIR=$(HOME)/workspace/yavsc
|
SOLUTIONDIR=../..
|
||||||
version := $(shell cat $(SOLUTIONDIR)/version.txt)
|
version := $(shell cat $(SOLUTIONDIR)/version.txt)
|
||||||
MAKE=make
|
MAKE=make
|
||||||
NUGETSOURCE=$(HOME)/Nupkgs
|
NUGETSOURCE=$(HOME)/Nupkgs
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,4 @@ namespace Yavsc.Attributes.Validation
|
||||||
return str.IsValidYavscPath();
|
return str.IsValidYavscPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
using System.IO;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Yavsc.ViewModels.UserFiles;
|
using Yavsc.ViewModels.UserFiles;
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Yavsc.Helpers
|
namespace Yavsc.Helpers
|
||||||
{
|
{
|
||||||
public static class AbstractFileSystemHelpers
|
public static class AbstractFileSystemHelpers
|
||||||
|
|
@ -50,7 +49,7 @@ namespace Yavsc.Helpers
|
||||||
{
|
{
|
||||||
if (ValidFileNameChars.Contains(c))
|
if (ValidFileNameChars.Contains(c))
|
||||||
sb.Append(c);
|
sb.Append(c);
|
||||||
else sb.Append('_');
|
else sb.Append("#"+((int)c).ToString("D3"));
|
||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +70,7 @@ namespace Yavsc.Helpers
|
||||||
public const char RemoteDirectorySeparator = '/';
|
public const char RemoteDirectorySeparator = '/';
|
||||||
|
|
||||||
// Only accept descent remote file names
|
// Only accept descent remote file names
|
||||||
public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. ".ToCharArray();
|
public static char[] ValidFileNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-=_~. %#".ToCharArray();
|
||||||
|
|
||||||
// Estimate signature file name format
|
// Estimate signature file name format
|
||||||
public static Func<string,string,long,string>
|
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 \
|
BASERESX=Resources/Yavsc.Attributes.Validation.Resources.resx \
|
||||||
Resources/Yavsc.Models.Messaging.Resources.resx \
|
Resources/Yavsc.Models.Messaging.Resources.resx \
|
||||||
Resources/Yavsc.Models.IT.Fixing.Bug.resx\
|
Resources/Yavsc.Models.IT.Fixing.Bug.resx\
|
||||||
|
|
|
||||||
|
|
@ -48,26 +48,6 @@ deploy-pkg: publish
|
||||||
|
|
||||||
deploy: pushInPre pushInProd
|
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
|
cleanPublish: pushInPre pushInProd
|
||||||
rm -rf bin/output/
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1 +1 @@
|
||||||
1.0.6-rc11
|
1.0.6-rc13
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue