Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getOriginalFileUrl() sometimes returns empty string #197

Closed
kukicado opened this issue Oct 25, 2022 · 1 comment
Closed

getOriginalFileUrl() sometimes returns empty string #197

kukicado opened this issue Oct 25, 2022 · 1 comment
Assignees
Labels

Comments

@kukicado
Copy link

Describe the bug

Expected behavior

I have a Laravel Action that takes an image from the local filesystem and uploads it to uploadcare. I am using the $uploader->fromPath() method and capturing the response in a $response variable:

$response = $uploader->fromPath($filePath, 'image/png');

and then returning the original file url by doing return $response->getOriginalFileUrl();.

The issue that I run into is, sometimes the $response->getOriginalFileUrl(); will return an empty string. The file still gets uploaded to uploadcare, I can access the $getUuuid() and $getOriginalFilename() methods just fine. I'm wondering if I'm doing something wrong or is there a way to wait until $response->getOriginalFileUrl() is populated?

Code / screenshots

Environment

  • Library version: 3.2.4
  • Language/framework version: Laravel 9 / PHP 8.1
  • OS version: Ubuntu 22
@kukicado kukicado added the bug label Oct 25, 2022
@kukicado kukicado changed the title getOriginalFileUrl() sometimes returns empty getOriginalFileUrl() sometimes returns empty string Oct 25, 2022
@rsedykh rsedykh assigned andrew72ru and rsedykh and unassigned andrew72ru Oct 25, 2022
@rsedykh
Copy link
Member

rsedykh commented Oct 26, 2022

Hi. original_file_url is publicly available if a file is not deleted (or not yet stored).

That's why getOriginalFileUrl returns you an empty string. Use $response->isReady()) to check it's readiness before you can get an original file URL.

@rsedykh rsedykh closed this as completed Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants