Using drush strips out the domain name of a file uri

Created on 8 February 2019, almost 6 years ago
Updated 23 December 2024, about 1 month ago

I want to execute a View and export the json file to the files directory. I am using views Data export and VDE drush add-on modules. My view has a file/pdf field and I want to provide a direct link to the pdf file. So I added a Views relation for the field and a file URI formatter field. When I go to see the output the View creates at the Path. The url is an absolute link directly to the pdf file. The url includes the domain name when viewing it on development or production instances. And this is what I want.
This is the correct url path in the json:
href=\u0022http:\/\/mysite.com\/files\/Allergens.pdf

But when I use this drush command below provided by views_data_export or vde_drush.
drush vde myview myviewid myfile.json
The domain name is stripped out like this:
href=\u0022http:\/\/default\/files\/Allergens.pdf

Why is this happening only when using the drush command? I found I can fix it by adding this at the end of the command. --uri=mysite.com
So my new drush command looks like this:
drush vde myview myviewid myfile.json --uri=mysite.com

But doing this will hardcode the domain name into the url. I want the url to work on development, production and on my local.
Thank you for any help you can provide.

πŸ› Bug report
Status

Closed: works as designed

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States leisurman

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom steven jones

    Yeah...this is the tricky thing with Drush: you need to tell it the URL of your site if you want it to know it.

    You have already found one way, you can use Drush aliases, or set environment variables in dev/staging/live etc.

    But yeah, this is a Drush issue, not a VDE one, and not really a bug either.

    You'd have the same issue for example if you execute cron without passing in the URL, or if you were to request a login link etc.

Production build 0.71.5 2024