1

Fix for "HTTP Request" Not Working with Google Drive Links

I've been troubleshooting why Tasker's "HTTP Request" action fails to download from a Google Drive link, even though "HTTP Get" works perfectly. After some digging, I found a simple fix that makes "HTTP Request" behave like "HTTP Get" in this case:

When using the "HTTP Request" action to download a file (like an image) from a URL such as:

https://drive.google.com/uc?export=download&id=YOUR_FILE_ID

Make sure you do both of the following:

  1. Enable "Automatically Follow Redirects"

  2. Add a Mime type custom header in the Headers field:

Accept: image/png

You can also add:

User-Agent: Mozilla/5.0

…to better emulate a browser.

5 replies

J

That's correct. It was ChatGPT that suggested this. It had never dawned on me to try it.

J

No problem.

<Action sr="act27" ve="7">
    <code>118</code>
    <label>download scene images to folder %BiaImagePath&lt;br&gt;REF: https://syncwithtech.blogspot.com/p/direct-download-link-generator.html?m=1</label>
    <se>false</se>
    <Str sr="arg0" ve="3">https://drive.google.com/uc?export=download&amp;id=**REDACTED_FILE_ID**</Str> <!-- URL -->
    <Str sr="arg1" ve="3"/>             <!-- User -->
    <Str sr="arg2" ve="3"/>             <!-- Password -->
    <Str sr="arg3" ve="3"/>             <!-- Proxy Host -->
    <Str sr="arg4" ve="3"/>             <!-- Proxy Port -->
    <Int sr="arg5" val="10"/>           <!-- Timeout (seconds) -->
    <Str sr="arg6" ve="3">image/png</Str> <!-- MIME Type -->
    <Str sr="arg7" ve="3">%BiaImagePath/map-pin.png</Str> <!-- Output File -->
    <Int sr="arg8" val="0"/>            <!-- Append: false -->
</Action>

Oh, ok, so the only real "hidden" part that wasn't immediately apparent was the fact that you had to enable the "Automatic Redirect" option, right? You were still adding the mime type manually even in the older action, correct?

J
<Action sr="act25" ve="7">
    <code>339</code>
    <label>download scene images to folder %BiaImagePath&lt;br&gt;REF: https://syncwithtech.blogspot.com/p/direct-download-link-generator.html?m=1&lt;br&gt;NOW WORKING 6/23/25&lt;br&gt;(added header and redirects)</label>
    <Bundle sr="arg0">
        <Vals sr="val">
            <net.dinglisch.android.tasker.RELEVANT_VARIABLES>
                &lt;StringArray sr=""&gt;
                &lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;%http_cookies&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;
                &lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1&gt;%http_file_output&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1&gt;
                &lt;/StringArray&gt;
            </net.dinglisch.android.tasker.RELEVANT_VARIABLES>
            <net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>[Ljava.lang.String;</net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>
        </Vals>
    </Bundle>
    <Int sr="arg1" val="0"/>                   <!-- Method: GET -->
    <Int sr="arg10" val="1"/>                  <!-- Follow Redirects: true -->
    <Int sr="arg11" val="0"/>
    <Int sr="arg12" val="1"/>                  <!-- Trust Any Certificate: true -->
    <Str sr="arg2" ve="3">https://drive.google.com/uc?export=download&amp;id=**REDACTED_FILE_ID**</Str> <!-- URL -->
    <Str sr="arg3" ve="3">Accept: image/png
User-Agent: Mozilla/5.0</Str>                <!-- Headers -->
    <Str sr="arg4" ve="3"/>                    <!-- Query Parameters (none) -->
    <Str sr="arg5" ve="3"/>                    <!-- Body Content (empty for GET) -->
    <Str sr="arg6" ve="3"/>                    <!-- Content Type -->
    <Str sr="arg7" ve="3">%BiaImagePath/map-pin.png</Str>  <!-- Output File -->
    <Int sr="arg8" val="30"/>                  <!-- Timeout (seconds) -->
    <Int sr="arg9" val="0"/>                   <!-- Output File Append: false -->
</Action>

Oh, I'm so sorry, I asked for the wrong thing 😅 I meant to ask for the HTTP Get action, so I can see what you're doing with that. Sorry about that!

J

Maybe the Redirect. I think my preference for the the header entry would be a 'Mime Type' field, like HTTP Get.

Can you please post the exact request you used in the HTTP Request action so I can see what it looks like? Thanks

Thanks. Are you suggesting that Tasker should do that automatically for Google Drive links?