Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit 72b9b8f

Browse files
committed
Merge branch 'pr/47'
2 parents 554679f + c42b8a9 commit 72b9b8f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Services/BingAds/ReportDownload.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,16 @@ protected function extractZip($location, $name)
129129
unlink($location);
130130
}
131131

132-
$data = file(storage_path('app/').$name.'.csv');
133-
134-
unlink(storage_path('app/').$name.'.csv');
132+
// Sometimes the report id has a extension starting with _
133+
// if this occurs we will just remove it.
134+
$fileNameLength = strpos($name, '_') > 0 ? strpos($name, '_') : strlen($name);
135+
$filePath = storage_path('app/') . substr($name, 0, $fileNameLength) . '.csv';
136+
137+
try {
138+
$data = file($filePath);
139+
} finally {
140+
unlink($filePath);
141+
}
135142

136143
return $data;
137144
}

0 commit comments

Comments
 (0)