Skip to content

Commit b1b8b98

Browse files
committed
trailing dot
1 parent ad6eb88 commit b1b8b98

13 files changed

+480
-16
lines changed

sdk/storage/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "cpp",
44
"TagPrefix": "cpp/storage",
5-
"Tag": "cpp/storage_92d8f38118"
5+
"Tag": "cpp/storage_f268e583e4"
66
}

sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
230230
private:
231231
Azure::Core::Url m_shareUrl;
232232
std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;
233+
Nullable<bool> m_allowTrailingDot;
234+
Nullable<bool> m_allowSourceTrailingDot;
233235

234236
explicit ShareClient(
235237
Azure::Core::Url shareUrl,

sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
260260
private:
261261
Azure::Core::Url m_shareDirectoryUrl;
262262
std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;
263+
Nullable<bool> m_allowTrailingDot;
264+
Nullable<bool> m_allowSourceTrailingDot;
263265

264266
explicit ShareDirectoryClient(
265267
Azure::Core::Url shareDirectoryUrl,

sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
363363
private:
364364
Azure::Core::Url m_shareFileUrl;
365365
std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;
366+
Nullable<bool> m_allowTrailingDot;
367+
Nullable<bool> m_allowSourceTrailingDot;
366368

367369
explicit ShareFileClient(
368370
Azure::Core::Url shareFileUrl,

sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
2626
* API version used by this client.
2727
*/
2828
std::string ApiVersion;
29+
30+
/**
31+
* If set to true, trailing dot (.) will be allowed to suffix directory and file names.
32+
* If false, the trailing dot will be trimmed.
33+
* Supported by x-ms-version 2022-11-02 and above.
34+
*/
35+
Nullable<bool> AllowTrailingDot;
36+
37+
/**
38+
* If set to true, trailing dot (.) will be allowed to source file names.
39+
* If false, the trailing dot will be trimmed.
40+
* Supported by x-ms-version 2022-11-02 and above.
41+
*/
42+
Nullable<bool> AllowSourceTrailingDot;
2943
};
3044

3145
/**

sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_service_client.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
102102
private:
103103
Azure::Core::Url m_serviceUrl;
104104
std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;
105+
Nullable<bool> m_allowTrailingDot;
106+
Nullable<bool> m_allowSourceTrailingDot;
105107
};
106108
}}}} // namespace Azure::Storage::Files::Shares

sdk/storage/azure-storage-files-shares/src/share_client.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
4343
const std::string& shareUrl,
4444
std::shared_ptr<StorageSharedKeyCredential> credential,
4545
const ShareClientOptions& options)
46-
: m_shareUrl(shareUrl)
46+
: m_shareUrl(shareUrl), m_allowTrailingDot(options.AllowTrailingDot),
47+
m_allowSourceTrailingDot(options.AllowSourceTrailingDot)
4748
{
4849
ShareClientOptions newOptions = options;
4950
newOptions.PerRetryPolicies.emplace_back(
@@ -63,7 +64,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
6364
}
6465

6566
ShareClient::ShareClient(const std::string& shareUrl, const ShareClientOptions& options)
66-
: m_shareUrl(shareUrl)
67+
: m_shareUrl(shareUrl), m_allowTrailingDot(options.AllowTrailingDot),
68+
m_allowSourceTrailingDot(options.AllowSourceTrailingDot)
6769
{
6870
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>> perRetryPolicies;
6971
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>> perOperationPolicies;
@@ -80,7 +82,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
8082

8183
ShareDirectoryClient ShareClient::GetRootDirectoryClient() const
8284
{
83-
return ShareDirectoryClient(m_shareUrl, m_pipeline);
85+
ShareDirectoryClient directoryClient(m_shareUrl, m_pipeline);
86+
directoryClient.m_allowTrailingDot = m_allowTrailingDot;
87+
directoryClient.m_allowSourceTrailingDot = m_allowSourceTrailingDot;
88+
return directoryClient;
8489
}
8590

8691
ShareClient ShareClient::WithSnapshot(const std::string& snapshot) const

sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
4545
const std::string& shareDirectoryUrl,
4646
std::shared_ptr<StorageSharedKeyCredential> credential,
4747
const ShareClientOptions& options)
48-
: m_shareDirectoryUrl(shareDirectoryUrl)
48+
: m_shareDirectoryUrl(shareDirectoryUrl), m_allowTrailingDot(options.AllowTrailingDot),
49+
m_allowSourceTrailingDot(options.AllowSourceTrailingDot)
4950
{
5051
ShareClientOptions newOptions = options;
5152
newOptions.PerRetryPolicies.emplace_back(
@@ -67,7 +68,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
6768
ShareDirectoryClient::ShareDirectoryClient(
6869
const std::string& shareDirectoryUrl,
6970
const ShareClientOptions& options)
70-
: m_shareDirectoryUrl(shareDirectoryUrl)
71+
: m_shareDirectoryUrl(shareDirectoryUrl), m_allowTrailingDot(options.AllowTrailingDot),
72+
m_allowSourceTrailingDot(options.AllowSourceTrailingDot)
7173
{
7274
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>> perRetryPolicies;
7375
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>> perOperationPolicies;
@@ -87,14 +89,20 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
8789
{
8890
auto builder = m_shareDirectoryUrl;
8991
builder.AppendPath(_internal::UrlEncodePath(subdirectoryName));
90-
return ShareDirectoryClient(builder, m_pipeline);
92+
ShareDirectoryClient subdirectoryClient(builder, m_pipeline);
93+
subdirectoryClient.m_allowTrailingDot = m_allowTrailingDot;
94+
subdirectoryClient.m_allowSourceTrailingDot = m_allowSourceTrailingDot;
95+
return subdirectoryClient;
9196
}
9297

9398
ShareFileClient ShareDirectoryClient::GetFileClient(const std::string& fileName) const
9499
{
95100
auto builder = m_shareDirectoryUrl;
96101
builder.AppendPath(_internal::UrlEncodePath(fileName));
97-
return ShareFileClient(builder, m_pipeline);
102+
ShareFileClient fileClient(builder, m_pipeline);
103+
fileClient.m_allowTrailingDot = m_allowTrailingDot;
104+
fileClient.m_allowSourceTrailingDot = m_allowSourceTrailingDot;
105+
return fileClient;
98106
}
99107

100108
ShareDirectoryClient ShareDirectoryClient::WithShareSnapshot(
@@ -163,6 +171,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
163171
{
164172
protocolLayerOptions.FilePermission = std::string(FileInheritPermission);
165173
}
174+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
166175
auto result = _detail::DirectoryClient::Create(
167176
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
168177
Models::CreateDirectoryResult ret;
@@ -244,11 +253,15 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
244253
{
245254
protocolLayerOptions.FilePermissionKey = options.SmbProperties.PermissionKey;
246255
}
256+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
257+
protocolLayerOptions.AllowSourceTrailingDot = m_allowSourceTrailingDot;
247258

248259
auto response = _detail::FileClient::Rename(
249260
*m_pipeline, destinationFileUrl, protocolLayerOptions, context);
250261

251262
auto renamedFileClient = ShareFileClient(destinationFileUrl, m_pipeline);
263+
renamedFileClient.m_allowTrailingDot = m_allowTrailingDot;
264+
renamedFileClient.m_allowSourceTrailingDot = m_allowSourceTrailingDot;
252265
return Azure::Response<ShareFileClient>(
253266
std::move(renamedFileClient), std::move(response.RawResponse));
254267
}
@@ -300,13 +313,17 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
300313
{
301314
protocolLayerOptions.FilePermissionKey = options.SmbProperties.PermissionKey;
302315
}
316+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
317+
protocolLayerOptions.AllowSourceTrailingDot = m_allowSourceTrailingDot;
303318

304319
auto response = _detail::DirectoryClient::Rename(
305320
*m_pipeline, destinationDirectoryUrl, protocolLayerOptions, context);
306321

307-
auto renamedFileClient = ShareDirectoryClient(destinationDirectoryUrl, m_pipeline);
322+
auto renamedSubdirectoryClient = ShareDirectoryClient(destinationDirectoryUrl, m_pipeline);
323+
renamedSubdirectoryClient.m_allowTrailingDot = m_allowTrailingDot;
324+
renamedSubdirectoryClient.m_allowSourceTrailingDot = m_allowSourceTrailingDot;
308325
return Azure::Response<ShareDirectoryClient>(
309-
std::move(renamedFileClient), std::move(response.RawResponse));
326+
std::move(renamedSubdirectoryClient), std::move(response.RawResponse));
310327
}
311328

312329
Azure::Response<Models::DeleteDirectoryResult> ShareDirectoryClient::Delete(
@@ -315,6 +332,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
315332
{
316333
(void)options;
317334
auto protocolLayerOptions = _detail::DirectoryClient::DeleteDirectoryOptions();
335+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
318336
auto result = _detail::DirectoryClient::Delete(
319337
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
320338
Models::DeleteDirectoryResult ret;
@@ -351,6 +369,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
351369
{
352370
(void)options;
353371
auto protocolLayerOptions = _detail::DirectoryClient::GetDirectoryPropertiesOptions();
372+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
354373
return _detail::DirectoryClient::GetProperties(
355374
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
356375
}
@@ -401,6 +420,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
401420
{
402421
protocolLayerOptions.FilePermission = FilePreserveSmbProperties;
403422
}
423+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
404424
return _detail::DirectoryClient::SetProperties(
405425
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
406426
}
@@ -414,6 +434,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
414434
auto protocolLayerOptions = _detail::DirectoryClient::SetDirectoryMetadataOptions();
415435
protocolLayerOptions.Metadata
416436
= std::map<std::string, std::string>(metadata.begin(), metadata.end());
437+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
417438
return _detail::DirectoryClient::SetMetadata(
418439
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
419440
}
@@ -429,6 +450,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
429450
protocolLayerOptions.MaxResults = options.PageSizeHint;
430451
protocolLayerOptions.Include = options.Include;
431452
protocolLayerOptions.IncludeExtendedInfo = options.IncludeExtendedInfo;
453+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
432454
auto response = _detail::DirectoryClient::ListFilesAndDirectoriesSegment(
433455
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
434456

@@ -499,6 +521,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
499521
protocolLayerOptions.Marker = options.ContinuationToken;
500522
protocolLayerOptions.MaxResults = options.PageSizeHint;
501523
protocolLayerOptions.Recursive = options.Recursive;
524+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
502525
auto response = _detail::DirectoryClient::ListHandles(
503526
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
504527

@@ -545,6 +568,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
545568
(void)options;
546569
auto protocolLayerOptions = _detail::DirectoryClient::ForceDirectoryCloseHandlesOptions();
547570
protocolLayerOptions.HandleId = handleId;
571+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
548572
auto result = _detail::DirectoryClient::ForceCloseHandles(
549573
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
550574
Models::ForceCloseDirectoryHandleResult ret;
@@ -560,6 +584,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
560584
protocolLayerOptions.HandleId = FileAllHandles;
561585
protocolLayerOptions.Marker = options.ContinuationToken;
562586
protocolLayerOptions.Recursive = options.Recursive;
587+
protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot;
563588
auto response = _detail::DirectoryClient::ForceCloseHandles(
564589
*m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context);
565590

0 commit comments

Comments
 (0)