File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Unreleased
2
2
- Legacy pre Xcode 10 compatibility checks removed. (#6486 )
3
+ - ` GDTCORDirectorySizeTracker ` crash fixed. (#6540 )
3
4
4
5
# v7.4.0
5
6
- Limit disk space consumed by GoogleDataTransport to store events. (#6365 )
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ - (void)resetCachedSize {
69
69
- (GDTCORStorageSizeBytes)calculateDirectoryContentSize {
70
70
NSArray *prefetchedProperties = @[ NSURLIsRegularFileKey , NSURLFileSizeKey ];
71
71
uint64_t totalBytes = 0 ;
72
- NSURL *directoryURL = [NSURL URLWithString :self .directoryPath];
72
+ NSURL *directoryURL = [NSURL fileURLWithPath :self .directoryPath];
73
73
74
74
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager ]
75
75
enumeratorAtURL: directoryURL
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2020 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ #import < XCTest/XCTest.h>
18
+
19
+ #import " GoogleDataTransport/GDTCORLibrary/Internal/GDTCORDirectorySizeTracker.h"
20
+
21
+ @interface GDTCORDirectorySizeTrackerTests : XCTestCase
22
+
23
+ @end
24
+
25
+ @implementation GDTCORDirectorySizeTrackerTests
26
+
27
+ - (void )testDirectoryContentSizeDoesNotCrashWhenDirectoryPathContainsWhitespaces {
28
+ NSString *pathWithSpaces = [NSTemporaryDirectory () stringByAppendingPathComponent: @" some dir" ];
29
+ GDTCORDirectorySizeTracker *tracker =
30
+ [[GDTCORDirectorySizeTracker alloc ] initWithDirectoryPath: pathWithSpaces];
31
+
32
+ XCTAssertNoThrow ([tracker directoryContentSize ]);
33
+ }
34
+
35
+ @end
You can’t perform that action at this time.
0 commit comments