Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e4bbf11
AWS S3 Add Support for using Custom Service URls such as: Minio, Orac…
ggallotti Sep 30, 2020
7b337d8
Remove IBM Bluemix as has been deprecated by IBM
ggallotti Jun 18, 2020
23f7ba4
External Provider improvements first bits
ggallotti Jun 1, 2021
182c1b4
Initial bits with Unit Tests
ggallotti Jun 10, 2021
48fe32c
Support for Path Style urls
ggallotti Jun 18, 2020
28f24b4
Merge branch 'master' into storage-private-support
ggallotti Jun 10, 2021
cb9d170
Add Minio Unit Tests
ggallotti Jun 10, 2021
c46de1e
Merge branch 'storage-private-support' of https://github.com/genexusl…
ggallotti Jun 10, 2021
c7f0550
Remove launchSettings.json
ggallotti Jun 10, 2021
d759a2a
Remove Secrets
ggallotti Jun 11, 2021
32542a2
Every file is now private
ggallotti Jun 11, 2021
57988be
Always add a GUID suffix to the name of uploaded image files.
claudiamurialdo Jun 4, 2021
08dcb7f
Support for Private storage
claudiamurialdo Jun 7, 2021
584691f
Merge branch 'master' into storage-private-support
ggallotti Jun 14, 2021
de2ba31
Add Workflow for External Storage Unit Tests
ggallotti Jun 14, 2021
2ff8044
Merge branch 'master' into storage-private-support
ggallotti Jun 14, 2021
c1967e8
Merge branch 'storage-private-support' of https://github.com/genexusl…
ggallotti Jun 14, 2021
05b99b3
Workflow renamed
ggallotti Jun 14, 2021
fa68e1b
Set Environment Variables
ggallotti Jun 14, 2021
cb50197
Set Environment Variables
ggallotti Jun 14, 2021
5f46947
Merge branch 'master' into storage-private-support
ggallotti Jun 16, 2021
73dac97
Remove commented code
ggallotti Jun 16, 2021
ef2692d
Remove commented code
ggallotti Jun 16, 2021
58c7cfa
Use TimeSpan instead of Minutes
ggallotti Jun 16, 2021
fa818dd
Use TimeSpan instead of Minutes
ggallotti Jun 16, 2021
9b07823
Do not require Folder Name
ggallotti Jun 16, 2021
69d9508
Default expiration fix
ggallotti Jun 16, 2021
0e630cf
Add an environment to the testing workflow
jechague Jun 17, 2021
2198d12
Fix JSON quote
jechague Jun 17, 2021
6d175b9
Do not require S3 Endpoint.
ggallotti Jun 17, 2021
826e989
Merge branch 'storage-private-support' of https://github.com/genexusl…
ggallotti Jun 17, 2021
f82a7d4
Merge branch 'master' into storage-private-support
ggallotti Jun 17, 2021
69a8258
Skip tests if Env Variables not set
ggallotti Jun 17, 2021
29a4690
Change S3 Bucket Name
ggallotti Jun 18, 2021
77b46c8
Fix error: The project exceeded the rate limit for bucket operations
ggallotti Jun 18, 2021
65542b3
Do not run Tests in parallel, as Google fails by rate limiter.
ggallotti Jun 18, 2021
c7e07b7
Merge branch 'master' into storage-private-support
ggallotti Jun 21, 2021
1ba930d
Merge branch 'master' into storage-private-support
ggallotti Jun 22, 2021
8c1a5e9
#Fix: Multimedia files must be server with default access policy and …
ggallotti Jun 23, 2021
a0fb497
&File support for External Provider URLs
ggallotti Jun 24, 2021
08c3ecf
StorageProvider: Folder name was not honored
ggallotti Jun 25, 2021
57403e2
FolderName duplicate
ggallotti Jun 28, 2021
2f9a620
Merge branch 'master' into storage-private-support
ggallotti Jun 28, 2021
fc59a9c
Azure baseURl should consider Private Container name instead of Publi…
ggallotti Jun 29, 2021
6d4bc0d
Merge branch 'storage-private-support' of https://github.com/genexusl…
ggallotti Jun 29, 2021
1f0360c
Fix Minio Signed Urls when https not supported
ggallotti Jun 29, 2021
f69c298
Fix Google Cloud Storage not returing valid signed urls in some scena…
ggallotti Jun 29, 2021
78e4ef5
Azure & Google Default ACL was not honored.
ggallotti Jul 1, 2021
2295530
Restore Concept of Attributes in GXFileType in order to differentiate…
ggallotti Jul 1, 2021
727b992
Merge branch 'master' into storage-private-support
ggallotti Jul 1, 2021
71cd95a
Try fix Google Cloud Storage Bug. https://github.com/googleapis/googl…
ggallotti Jul 1, 2021
03b99c2
#Fix: ContentType was forced to image/jpeg for every Multimedia and B…
ggallotti Jul 2, 2021
35b9af2
Merge branch 'master' into storage-private-support
ggallotti Jul 2, 2021
580dfb5
Disable temporally TestDeleteFile Private Test as is failing randomly…
ggallotti Jul 2, 2021
410946b
Merge branch 'storage-private-support' of https://github.com/genexusl…
ggallotti Jul 2, 2021
3387637
More private test cases for Providers S3, Azure, Google
ggallotti Jul 5, 2021
d64487c
Add Oracle UnitTest and include WA for Google Cloud Storage Bug (http…
ggallotti Jul 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/External-Storage-Tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: External Storage Tests

on:
pull_request:
branches:
- 'master'
- 'release-*'
push:
branches:
- 'master'
- 'beta'
- 'release-*'

jobs:
build:
env:
GIT_REF: ${{ github.ref }}
GIT_SHA: ${{ github.sha }}
Configuration: Release
SolutionFile: dotnet\DotNetStandardClasses.sln

runs-on: windows-latest
environment: external-storage-tests

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'

- name: Install .NET 6
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: '6.0.100-preview.3.21202.5'

- uses: actions/setup-dotnet@v1
with:
source-url: https://nuget.pkg.github.com/genexuslabs/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Calculate environment variables
run: |
$IsPrerelease = !($Env:GIT_REF -match 'release-[0-9]+(?:\.[0-9]+)?$')
echo "IsPrerelease=$IsPrerelease" >> $env:GITHUB_ENV

$COMMIT_NUMBER = @($(git rev-list --count origin/master..), $(git rev-list --count HEAD))[$IsPrerelease]

echo "COMMIT_NUMBER=$COMMIT_NUMBER" >> $env:GITHUB_ENV

- name: Calculate package version
env:
PackageVersionString: ./.github/generatePackageVersion.ps1
run: |
$NuGetPackageVersion = & "$Env:PackageVersionString"

Write-Output "Packge version to be used: $NuGetPackageVersion"

echo "NuGetPackageVersion=$NuGetPackageVersion" >> $env:GITHUB_ENV

- name: Restore packages
run: dotnet restore $Env:SolutionFile

- name: Build
run: dotnet build $Env:SolutionFile --no-restore --configuration $Env:Configuration

- name: Test External Storage
run: |
$Env:AWSS3_TEST_ENABLED="true"
$Env:STORAGE_AWSS3_ACCESS_KEY="${{ secrets.AWSS3_ACCESS_KEY }}"
$Env:STORAGE_AWSS3_SECRET_KEY="${{ secrets.AWSS3_SECRET_KEY }}"
$Env:STORAGE_AWSS3_BUCKET_NAME="genexus-s3-test"
$Env:STORAGE_AWSS3_FOLDER_NAME="gxclasses"
$Env:STORAGE_AWSS3_REGION="us-east-1"
$Env:IBMCOS_TEST_ENABLED="true"
$Env:STORAGE_IBMCOS_ACCESS_KEY="${{ secrets.IBMCOS_ACCESS_KEY }}"
$Env:STORAGE_IBMCOS_SECRET_KEY="${{ secrets.IBMCOS_SECRET_KEY }}"
$Env:STORAGE_IBMCOS_BUCKET_NAME="gxclasses-unit-tests"
$Env:STORAGE_IBMCOS_FOLDER_NAME="tests"
$Env:STORAGE_IBMCOS_REGION="us-south"
$Env:AZUREBS_TEST_ENABLED="true"
$Env:STORAGE_AZUREBS_ACCESS_KEY="${{ secrets.AZUREBS_ACCESS_KEY }}"
$Env:STORAGE_AZUREBS_ACCOUNT_NAME="${{ secrets.AZUREBS_ACCOUNT_NAME }}"
$Env:STORAGE_AZUREBS_FOLDER_NAME="tests"
$Env:STORAGE_AZUREBS_PUBLIC_CONTAINER_NAME="contluispublic"
$Env:STORAGE_AZUREBS_PRIVATE_CONTAINER_NAME="contluisprivate"
$Env:GOOGLECS_TEST_ENABLED="true"
$Env:STORAGE_GOOGLECS_KEY='${{ secrets.GOOGLECS_KEY }}'
$Env:STORAGE_GOOGLECS_PROJECT_ID="gxjavacloudstorageunittests"
$Env:STORAGE_GOOGLECS_BUCKET_NAME="javaclasses-unittests"
$Env:STORAGE_GOOGLECS_FOLDER_NAME="gxclasses"
$Env:STORAGE_GOOGLECS_APPLICATION_NAME="gxjavacloudstorageunittests"

dotnet test $Env:SolutionFile --no-restore --no-build --configuration $Env:Configuration

7 changes: 0 additions & 7 deletions dotnet/DotNetStandardClasses.sln
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GXAmazonS3", "src\dotnetfra
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GXAzureStorage", "src\dotnetframework\Providers\Storage\GXAzureStorage\GXAzureStorage.csproj", "{F6372249-AF37-4455-B572-5BDF8DE2ACC8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GXBluemix", "src\dotnetframework\Providers\Storage\GXBluemix\GXBluemix.csproj", "{FCA5536D-542E-480E-92B0-316E0290553B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GXGoogleCloud", "src\dotnetframework\Providers\Storage\GXGoogleCloud\GXGoogleCloud.csproj", "{E9072D95-D116-4D4B-B981-46146BCDE052}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GXOpenStack", "src\dotnetframework\Providers\Storage\GXOpenStack\GXOpenStack.csproj", "{64E958D8-CE7B-482D-B339-3B52E26CA4AC}"
Expand Down Expand Up @@ -241,10 +239,6 @@ Global
{F6372249-AF37-4455-B572-5BDF8DE2ACC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6372249-AF37-4455-B572-5BDF8DE2ACC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6372249-AF37-4455-B572-5BDF8DE2ACC8}.Release|Any CPU.Build.0 = Release|Any CPU
{FCA5536D-542E-480E-92B0-316E0290553B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCA5536D-542E-480E-92B0-316E0290553B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCA5536D-542E-480E-92B0-316E0290553B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FCA5536D-542E-480E-92B0-316E0290553B}.Release|Any CPU.Build.0 = Release|Any CPU
{E9072D95-D116-4D4B-B981-46146BCDE052}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9072D95-D116-4D4B-B981-46146BCDE052}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9072D95-D116-4D4B-B981-46146BCDE052}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -378,7 +372,6 @@ Global
{F82842DA-F15E-49C5-993E-4C269818FF1F} = {F900A4AD-7249-41B4-B918-CB9E8C73747C}
{3701565F-1A95-4592-B90D-291CCDE5505D} = {F82842DA-F15E-49C5-993E-4C269818FF1F}
{F6372249-AF37-4455-B572-5BDF8DE2ACC8} = {F82842DA-F15E-49C5-993E-4C269818FF1F}
{FCA5536D-542E-480E-92B0-316E0290553B} = {F82842DA-F15E-49C5-993E-4C269818FF1F}
{E9072D95-D116-4D4B-B981-46146BCDE052} = {F82842DA-F15E-49C5-993E-4C269818FF1F}
{64E958D8-CE7B-482D-B339-3B52E26CA4AC} = {F82842DA-F15E-49C5-993E-4C269818FF1F}
{A14C2C2C-ACE3-4712-A527-E4E5F02729FA} = {F900A4AD-7249-41B4-B918-CB9E8C73747C}
Expand Down
1 change: 1 addition & 0 deletions dotnet/src/dotnetcore/GxClasses/GxClasses.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<Compile Include="..\..\dotnetframework\GxClasses\Services\Search\GXSearch.cs" Link="Services\Search\GXSearch.cs" />
<Compile Include="..\..\dotnetframework\GxClasses\Security\GxSecurityProvider.cs" Link="Security\GxSecurityProvider.cs" />
<Compile Include="..\..\dotnetframework\GxClasses\Services\Storage\GXServices.cs" Link="Services\Storage\GXServices.cs" />
<Compile Include="..\..\dotnetframework\GxClasses\Services\Storage\ExternalProviderBase.cs" Link="Services\Storage\ExternalProviderBase.cs" />
<Compile Include="..\..\dotnetframework\GxClasses\Domain\GxSession.cs" Link="Domain\GxSession.cs" />
<Compile Include="..\..\dotnetframework\GxClasses\Model\GXSilentTrn.cs" Link="Model\GXSilentTrn.cs" />
<Compile Include="..\..\dotnetframework\GxClasses\Services\Caching\GxSmartCacheProvider.cs" Link="Services\Caching\GxSmartCacheProvider.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public bool Connect(string profileName, GXProperties properties, ref GxStoragePr

private void preprocess(String name, GXProperties properties)
{
string className = null;
string className;

switch (name)
{
Expand All @@ -104,37 +104,27 @@ private void preprocess(String name, GXProperties properties)
className = "GeneXus.Storage.GXAmazonS3.ExternalProviderS3";
SetDefaultProperty(properties, "STORAGE_PROVIDER_REGION", "us-east-1");
SetDefaultProperty(properties, "STORAGE_ENDPOINT", "s3.amazonaws.com");
SetEncryptProperty(properties, "STORAGE_PROVIDER_ACCESSKEYID");
SetEncryptProperty(properties, "STORAGE_PROVIDER_SECRETACCESSKEY");
SetEncryptProperty(properties, "BUCKET_NAME");
SetEncryptedProperty(properties, "STORAGE_PROVIDER_ACCESSKEYID");
SetEncryptedProperty(properties, "STORAGE_PROVIDER_SECRETACCESSKEY");
SetEncryptedProperty(properties, "BUCKET_NAME");
break;

case "AZURESTORAGE":
className = "GeneXus.Storage.GXAzureStorage.AzureStorageExternalProvider";
SetEncryptProperty(properties, "PUBLIC_CONTAINER_NAME");
SetEncryptProperty(properties, "PRIVATE_CONTAINER_NAME");
SetEncryptProperty(properties, "ACCOUNT_NAME");
SetEncryptProperty(properties, "ACCESS_KEY");
SetEncryptedProperty(properties, "PUBLIC_CONTAINER_NAME");
SetEncryptedProperty(properties, "PRIVATE_CONTAINER_NAME");
SetEncryptedProperty(properties, "ACCOUNT_NAME");
SetEncryptedProperty(properties, "ACCESS_KEY");
break;

case "BLUEMIXSTORAGE":
className = "GeneXus.Storage.GXBluemix.ExternalProviderBluemix";
SetDefaultProperty(properties, "SERVER_URL", "https://identity.open.softlayer.com");
SetDefaultProperty(properties, "STORAGE_PROVIDER_REGION", "dallas");
SetEncryptProperty(properties, "PUBLIC_BUCKET_NAME");
SetEncryptProperty(properties, "PRIVATE_BUCKET_NAME");
SetEncryptProperty(properties, "STORAGE_PROVIDER_USER");
SetEncryptProperty(properties, "STORAGE_PROVIDER_PASSWORD");
break;


//case "BOX":
// className = "{class}";
// break;

case "GOOGLE":
className = "GeneXus.Storage.GXGoogleCloud.ExternalProviderGoogle";
SetEncryptProperty(properties, "KEY");
SetEncryptProperty(properties, "BUCKET_NAME");
SetEncryptedProperty(properties, "KEY");
SetEncryptedProperty(properties, "BUCKET_NAME");
break;

//case "IBMCOS":
Expand All @@ -146,9 +136,9 @@ private void preprocess(String name, GXProperties properties)

case "OPENSTACKSTORAGE":
className = "GeneXus.Storage.GXOpenStack.ExternalProviderOpenStack";
SetEncryptProperty(properties, "BUCKET_NAME");
SetEncryptProperty(properties, "STORAGE_PROVIDER_USER");
SetEncryptProperty(properties, "STORAGE_PROVIDER_PASSWORD");
SetEncryptedProperty(properties, "BUCKET_NAME");
SetEncryptedProperty(properties, "STORAGE_PROVIDER_USER");
SetEncryptedProperty(properties, "STORAGE_PROVIDER_PASSWORD");
break;

default:
Expand All @@ -171,7 +161,7 @@ private void SetDefaultProperty(GXProperties properties, String prop, String val
properties.Set(prop, value);
}

private void SetEncryptProperty(GXProperties properties, String prop)
private void SetEncryptedProperty(GXProperties properties, String prop)
{
String value = properties.Get(prop);
if (string.IsNullOrEmpty(value))
Expand Down
9 changes: 3 additions & 6 deletions dotnet/src/dotnetframework/GxClasses/Core/GXApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -679,13 +679,10 @@ public static bool GetHttpRequestPostedFile(IGxContext gxContext, string varName
if (httpContext != null)
{
HttpPostedFile pf = httpContext.Request.GetFile(varName);
if (pf != null)
if (pf != null && pf.ContentLength > 0)
{
#pragma warning disable SCS0018 // Path traversal: injection possible in {1} argument passed to '{0}'
FileInfo fi = new FileInfo(pf.FileName);
#pragma warning restore SCS0018 // Path traversal: injection possible in {1} argument passed to '{0}'
string tempDir = Preferences.getTMP_MEDIA_PATH();
string ext = fi.Extension;
string ext = Path.GetExtension(pf.FileName);
if (ext != null)
ext = ext.TrimStart('.');
string filePath = FileUtil.getTempFileName(tempDir);
Expand All @@ -695,7 +692,7 @@ public static bool GetHttpRequestPostedFile(IGxContext gxContext, string varName
string fileGuid = GxUploadHelper.GetUploadFileGuid();
fileToken = GxUploadHelper.GetUploadFileId(fileGuid);

GxUploadHelper.CacheUploadFile(fileGuid, filePath, Path.GetFileName(pf.FileName), ext, file, gxContext);
GxUploadHelper.CacheUploadFile(fileGuid, Path.GetFileName(pf.FileName), ext, file, gxContext);

return true;
}
Expand Down
22 changes: 13 additions & 9 deletions dotnet/src/dotnetframework/GxClasses/Core/GXUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1116,12 +1116,13 @@ public bool Upload(string filefullpath, string storageobjectfullname, GxFile upl
try
{
ValidProvider();
GxFileType acl = GxFileType.PublicRead;
if (String.IsNullOrEmpty(storageobjectfullname))
{
storageobjectfullname = Path.GetFileName(filefullpath);
}
string url = provider.Upload(filefullpath, storageobjectfullname, GxFileType.Public);
uploadedFile.FileInfo = new GxExternalFileInfo(storageobjectfullname, url, provider);
string url = provider.Upload(filefullpath, storageobjectfullname, acl);
uploadedFile.FileInfo = new GxExternalFileInfo(storageobjectfullname, url, provider, acl);
return true;
}
catch (Exception ex)
Expand All @@ -1139,8 +1140,9 @@ public bool UploadPrivate(string filefullpath, string storageobjectfullname, GxF
{
storageobjectfullname=Path.GetFileName(filefullpath);
}
string url = provider.Upload(filefullpath, storageobjectfullname, GxFileType.Private);
uploadedFile.FileInfo = new GxExternalFileInfo(storageobjectfullname, url, provider);
GxFileType acl = GxFileType.Private;
string url = provider.Upload(filefullpath, storageobjectfullname, acl);
uploadedFile.FileInfo = new GxExternalFileInfo(storageobjectfullname, url, provider, acl);
return true;
}
catch (Exception ex)
Expand All @@ -1160,7 +1162,7 @@ public bool Download(string storageobjectfullname, GxFile localFile, GXBaseColle
destFileName = localFile.GetAbsoluteName();
else
destFileName = Path.Combine(GxContext.StaticPhysicalPath(), localFile.Source);
provider.Download(storageobjectfullname, destFileName, GxFileType.Public);
provider.Download(storageobjectfullname, destFileName, GxFileType.PublicRead);
return true;
}
catch (Exception ex)
Expand Down Expand Up @@ -1197,15 +1199,16 @@ public bool Get(string storageobjectfullname, GxFile externalFile, GXBaseCollect
try
{
ValidProvider();
string url = provider.Get(storageobjectfullname, GxFileType.Public, 0);
GxFileType acl = GxFileType.PublicRead;
string url = provider.Get(storageobjectfullname, acl, 0);
if (String.IsNullOrEmpty(url))
{
GXUtil.ErrorToMessages("Get Error", "File doesn't exists", messages);
return false;
}
else
{
externalFile.FileInfo = new GxExternalFileInfo(storageobjectfullname, url, provider);
externalFile.FileInfo = new GxExternalFileInfo(storageobjectfullname, url, provider, acl);
return true;
}
}
Expand All @@ -1222,15 +1225,16 @@ public bool GetPrivate(string storageobjectfullname, GxFile externalFile, int ex
try
{
ValidProvider();
string url = provider.Get(storageobjectfullname, GxFileType.Private, expirationMinutes);
GxFileType acl = GxFileType.Private;
string url = provider.Get(storageobjectfullname, acl, expirationMinutes);
if (String.IsNullOrEmpty(url))
{
GXUtil.ErrorToMessages("Get Error", "File doesn't exists", messages);
return false;
}
else
{
externalFile.FileInfo = new GxExternalFileInfo(storageobjectfullname, url, provider, GxFileType.Private);
externalFile.FileInfo = new GxExternalFileInfo(storageobjectfullname, url, provider, acl);
return true;
}
}
Expand Down
21 changes: 15 additions & 6 deletions dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
using System.Security.Cryptography;
using System.Collections.Concurrent;
using System.Drawing.Drawing2D;
using GeneXus.Storage;
using GeneXus.Services;

namespace GeneXus.Utils
{
Expand Down Expand Up @@ -3364,7 +3366,7 @@ public static string UriToPath(string uriString)
return uriString;
}
}
public static string getTempFileName(string baseDir, string name="", string extension="tmp", GxFileType fileType = GxFileType.Public)
public static string getTempFileName(string baseDir, string name="", string extension="tmp", GxFileType fileType = GxFileType.Private)
{
name = FixFileName(FileUtil.FileNamePrettify(name), string.Empty);
return tempFileName(baseDir, name, extension);
Expand Down Expand Up @@ -3409,7 +3411,7 @@ public static string GetFileType(string FileName)

if (GxUploadHelper.IsUpload(FileName))
{
return new GxFile(string.Empty, FileName, GxFileType.Private).GetExtension();
return new GxFile(string.Empty, FileName, GxFileType.PrivateAttribute).GetExtension();
}

string extension = string.Empty;
Expand Down Expand Up @@ -3454,7 +3456,7 @@ public static string GetFileName(string FileName)

if (GxUploadHelper.IsUpload(FileName))
{
FileName = new GxFile(string.Empty, FileName, GxFileType.Private).GetName();
FileName = new GxFile(string.Empty, FileName, GxFileType.PrivateAttribute).GetName();
}
try
{
Expand Down Expand Up @@ -5257,15 +5259,22 @@ public static string ResolveUri(string uriString, IGxContext context = null)
public static string ResolveUri(string uriString, bool absUrl, IGxContext context = null)
{
if (String.IsNullOrEmpty(uriString))
return "";
return string.Empty;

string providerObjectName;
if (PathUtil.IsAbsoluteUrl(uriString) && StorageFactory.TryGetProviderObjectName(ServiceFactory.GetExternalProvider(), uriString, out providerObjectName))
{
return new GxFile(string.Empty, providerObjectName, GxFileType.DefaultAttribute).GetURI();
}

if (schemeRegex.IsMatch(uriString))
{
string fileName = schemeRegex.Replace(uriString, "");
//Same way as getBlobFile, creates a GxFile in order to take into account external storage when enabled.
string basePath = Path.Combine(Path.Combine(Preferences.getBLOB_PATH(), MultimediaDirectory));
try
{
GxFile file = new GxFile(string.Empty, PathUtil.SafeCombine(basePath, fileName), GxFileType.PublicAttribute);
GxFile file = new GxFile(string.Empty, PathUtil.SafeCombine(basePath, fileName), GxFileType.PrivateAttribute);
return PathToUrl(file.GetURI(), absUrl, context);
}
catch (ArgumentException ex)
Expand Down Expand Up @@ -5318,7 +5327,7 @@ public static string GetUriFromFile(string name, string type, string path)
{
if (GxUploadHelper.IsUpload(path))
{
return new GxFile(string.Empty, path, GxFileType.Private).GetName();
return new GxFile(string.Empty, path, GxFileType.PrivateAttribute).GetName();
}
string fromPathType = Path.GetExtension(path);
if (!String.IsNullOrEmpty(fromPathType) && fromPathType != "tmp")
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/dotnetframework/GxClasses/Data/GXDataCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ protected static byte[] GetBinary(string fileNameParm, bool dbBlob)
{
if (ServiceFactory.GetExternalProvider() != null)
{
GxFile file = new GxFile(string.Empty, fileNameParm, GxFileType.Private);
GxFile file = new GxFile(string.Empty, fileNameParm, GxFileType.PrivateAttribute);
if (file.Exists())
{
binary = file.ToByteArray();
Expand Down
Loading