Resolved an issue where path is not encoded. (#657)

This commit is contained in:
Kan Tang 2020-09-16 11:13:12 +08:00 committed by GitHub
parent 7584c208ab
commit 34944552ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 26 deletions

View File

@ -233,9 +233,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
explicit FileClient(
Azure::Core::Http::Url dfsUri,
Blobs::BlobClient blobClient,
Blobs::BlockBlobClient blockBlobClient,
std::shared_ptr<Azure::Core::Http::HttpPipeline> pipeline)
: PathClient(std::move(dfsUri), std::move(blobClient), pipeline),
m_blockBlobClient(blobClient.GetBlockBlobClient())
m_blockBlobClient(std::move(blockBlobClient))
{
}
friend class FileSystemClient;

View File

@ -27,8 +27,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
{
auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString);
auto directoryUri = std::move(parsedConnectionString.DataLakeServiceUri);
directoryUri.AppendPath(fileSystemName, true);
directoryUri.AppendPath(path, true);
directoryUri.AppendPath(fileSystemName);
directoryUri.AppendPath(path);
if (parsedConnectionString.KeyCredential)
{
@ -125,18 +125,20 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
FileClient DirectoryClient::GetFileClient(const std::string& path) const
{
auto builder = m_dfsUri;
builder.AppendPath(path, true);
builder.AppendPath(path);
auto blobClient = m_blobClient;
blobClient.m_blobUrl.AppendPath(path, true);
return FileClient(std::move(builder), std::move(blobClient), m_pipeline);
blobClient.m_blobUrl.AppendPath(path);
auto blockBlobClient = blobClient.GetBlockBlobClient();
return FileClient(
std::move(builder), std::move(blobClient), std::move(blockBlobClient), m_pipeline);
}
DirectoryClient DirectoryClient::GetSubDirectoryClient(const std::string& path) const
{
auto builder = m_dfsUri;
builder.AppendPath(path, true);
builder.AppendPath(path);
auto blobClient = m_blobClient;
blobClient.m_blobUrl.AppendPath(path, true);
blobClient.m_blobUrl.AppendPath(path);
return DirectoryClient(std::move(builder), std::move(blobClient), m_pipeline);
}

View File

@ -42,7 +42,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
{
auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString);
auto fileSystemUri = std::move(parsedConnectionString.DataLakeServiceUri);
fileSystemUri.AppendPath(fileSystemName, true);
fileSystemUri.AppendPath(fileSystemName);
if (parsedConnectionString.KeyCredential)
{
@ -151,7 +151,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
PathClient FileSystemClient::GetPathClient(const std::string& path) const
{
auto builder = m_dfsUri;
builder.AppendPath(path, true);
builder.AppendPath(path);
return PathClient(builder, m_blobContainerClient.GetBlobClient(path), m_pipeline);
}
@ -159,14 +159,17 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
{
auto builder = m_dfsUri;
builder.AppendPath(path, true);
return FileClient(builder, m_blobContainerClient.GetBlobClient(path), m_pipeline);
builder.AppendPath(path);
auto blobClient = m_blobContainerClient.GetBlobClient(path);
auto blockBlobClient = blobClient.GetBlockBlobClient();
return FileClient(
std::move(builder), std::move(blobClient), std::move(blockBlobClient), m_pipeline);
}
DirectoryClient FileSystemClient::GetDirectoryClient(const std::string& path) const
{
auto builder = m_dfsUri;
builder.AppendPath(path, true);
builder.AppendPath(path);
return DirectoryClient(builder, m_blobContainerClient.GetBlobClient(path), m_pipeline);
}

View File

@ -86,8 +86,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
{
auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString);
auto pathUri = std::move(parsedConnectionString.DataLakeServiceUri);
pathUri.AppendPath(fileSystemName, true);
pathUri.AppendPath(path, true);
pathUri.AppendPath(fileSystemName);
pathUri.AppendPath(path);
if (parsedConnectionString.KeyCredential)
{

View File

@ -155,7 +155,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
FileSystemClient ServiceClient::GetFileSystemClient(const std::string& fileSystemName) const
{
auto builder = m_dfsUri;
builder.AppendPath(fileSystemName, true);
builder.AppendPath(fileSystemName);
return FileSystemClient(
builder, m_blobServiceClient.GetBlobContainerClient(fileSystemName), m_pipeline);
}

View File

@ -23,7 +23,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString);
auto shareUri = std::move(parsedConnectionString.FileServiceUri);
shareUri.AppendPath(shareName, true);
shareUri.AppendPath(shareName);
if (parsedConnectionString.KeyCredential)
{
@ -118,14 +118,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
DirectoryClient ShareClient::GetDirectoryClient(const std::string& directoryPath) const
{
auto builder = m_shareUri;
builder.AppendPath(directoryPath, true);
builder.AppendPath(directoryPath);
return DirectoryClient(builder, m_pipeline);
}
FileClient ShareClient::GetFileClient(const std::string& filePath) const
{
auto builder = m_shareUri;
builder.AppendPath(filePath, true);
builder.AppendPath(filePath);
return FileClient(builder, m_pipeline);
}

View File

@ -23,8 +23,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString);
auto directoryUri = std::move(parsedConnectionString.FileServiceUri);
directoryUri.AppendPath(shareName, true);
directoryUri.AppendPath(directoryPath, true);
directoryUri.AppendPath(shareName);
directoryUri.AppendPath(directoryPath);
if (parsedConnectionString.KeyCredential)
{
@ -121,14 +121,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
DirectoryClient DirectoryClient::GetSubDirectoryClient(const std::string& subDirectoryName) const
{
auto builder = m_shareDirectoryUri;
builder.AppendPath(subDirectoryName, true);
builder.AppendPath(subDirectoryName);
return DirectoryClient(builder, m_pipeline);
}
FileClient DirectoryClient::GetFileClient(const std::string& filePath) const
{
auto builder = m_shareDirectoryUri;
builder.AppendPath(filePath, true);
builder.AppendPath(filePath);
return FileClient(builder, m_pipeline);
}

View File

@ -26,8 +26,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
{
auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString);
auto fileUri = std::move(parsedConnectionString.FileServiceUri);
fileUri.AppendPath(shareName, true);
fileUri.AppendPath(filePath, true);
fileUri.AppendPath(shareName);
fileUri.AppendPath(filePath);
if (parsedConnectionString.KeyCredential)
{

View File

@ -114,7 +114,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
ShareClient ServiceClient::GetShareClient(const std::string& shareName) const
{
auto builder = m_serviceUri;
builder.AppendPath(shareName, true);
builder.AppendPath(shareName);
return ShareClient(builder, m_pipeline);
}