Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit d669f5d

Browse files
katmsftvinjiang
authored andcommitted
Resolved an issue where listing directories and files does not return any length value when �s_file is called.
1 parent 438e8a8 commit d669f5d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Microsoft.WindowsAzure.Storage/includes/was/file.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3252,6 +3252,7 @@ namespace azure { namespace storage {
32523252

32533253
friend class cloud_file;
32543254
friend class protocol::file_response_parsers;
3255+
friend class list_file_and_directory_item;
32553256
};
32563257

32573258
enum class file_range_write
@@ -5079,7 +5080,9 @@ namespace azure { namespace storage {
50795080
{
50805081
throw std::runtime_error("Cannot access a cloud file directory as cloud file");
50815082
}
5082-
return cloud_file(m_name, m_directory);
5083+
cloud_file result = cloud_file(m_name, m_directory);
5084+
result.properties().m_length = static_cast<utility::size64_t>(m_length);
5085+
return result;
50835086
}
50845087

50855088
/// <summary>

Microsoft.WindowsAzure.Storage/tests/cloud_file_directory_test.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ SUITE(File)
237237
CHECK(file.metadata().empty());
238238
CHECK(file.properties().etag().empty());
239239
CHECK(!file.properties().last_modified().is_initialized());
240+
CHECK_EQUAL(512U, file.properties().length());
240241

241242
for (auto file_name = files_three.begin(); file_name != files_three.end(); file_name++)
242243
{
@@ -258,6 +259,7 @@ SUITE(File)
258259
CHECK(file.metadata().empty());
259260
CHECK(file.properties().etag().empty());
260261
CHECK(!file.properties().last_modified().is_initialized());
262+
CHECK_EQUAL(512U, file.properties().length());
261263

262264
for (auto file_name = files_two.begin(); file_name != files_two.end(); file_name++)
263265
{
@@ -282,6 +284,7 @@ SUITE(File)
282284
CHECK(file.metadata().empty());
283285
CHECK(file.properties().etag().empty());
284286
CHECK(!file.properties().last_modified().is_initialized());
287+
CHECK_EQUAL(512U, file.properties().length());
285288

286289
for (auto file_name = files_one.begin(); file_name != files_one.end(); file_name++)
287290
{
@@ -323,7 +326,7 @@ SUITE(File)
323326
}
324327

325328
size_t num_items_expected = directories.size() + files.size();
326-
int num_items_actual = 0;
329+
size_t num_items_actual = 0;
327330
for (auto&& item : m_directory.list_files_and_directories(prefix))
328331
{
329332
++num_items_actual;

0 commit comments

Comments
 (0)