Skip to content

Commit cb088c1

Browse files
authored
Fixes preg_match in vision pdf example (GoogleCloudPlatform#898)
fixes GoogleCloudPlatform#885
1 parent 4b88333 commit cb088c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vision/src/detect_pdf_gcs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ function detect_pdf_gcs($path, $output)
7070

7171
# once the request has completed and the output has been
7272
# written to GCS, we can list all the output files.
73-
preg_match('/^gs:\/\/([a-z0-9\._\-]+)\/(\S+)$/', $output, $match);
73+
preg_match('/^gs:\/\/([a-zA-Z0-9\._\-]+)\/?(\S+)?$/', $output, $match);
7474
$bucketName = $match[1];
75-
$prefix = $match[2];
75+
$prefix = isset($match[2]) ? $match[2] : '';
7676

7777
$storage = new StorageClient();
7878
$bucket = $storage->bucket($bucketName);

0 commit comments

Comments
 (0)