<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Download files as blob using dropbox chooser in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/620734#M28618</link>
    <description>&lt;P&gt;I see, thanks for the additional information. Unfortunately the Dropbox Chooser doesn't support direct links for folders, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And Dropbox shared links on &lt;A href="http://www.dropbox.com" target="_blank"&gt;www.dropbox.com&lt;/A&gt; themselves unfortunately don't support CORS, so I'm afraid I don't have a good solution to offer here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, regarding the URL parsing, the code you shared could result in an incorrect URL like "&lt;A href="https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=0?dl=1&amp;quot;," target="_blank"&gt;https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=0?dl=1",&lt;/A&gt; instead of the correct "&lt;A href="https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=1&amp;quot;," target="_blank"&gt;https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=1",&lt;/A&gt; since you're just appending instead of replacing the URL parameter, if already present.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Sep 2022 13:31:22 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2022-09-06T13:31:22Z</dc:date>
    <item>
      <title>Download files as blob using dropbox chooser</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/619685#M28539</link>
      <description>&lt;P&gt;So I have integrated dropbox into my react app and my app successfully opens a dropbox dialog box, signs in users and list their files and folders. I am facing issues with the &lt;STRONG&gt;downloading of the selected files as blobs&lt;/STRONG&gt;. Here is my code which handles the listing of files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt; case 'DROPBOX':
          const successCb = async (
            files: ReadonlyArray&amp;lt;Dropbox.ChooserFile&amp;gt;
          ) =&amp;gt; {
            console.log(files);
            const blobs = files.map((f) =&amp;gt; {
              return axios.get(
                f.link + '?dl=1',
                {
                  responseType: 'blob',
                  headers: {
                    Authorization: `Bearer MY_TOKEN`,
                  },
                }
              );
            });

            console.log(await Promise.allSettled(blobs));
          };

          createDropboxChooser(
            { successCb },
            {
              multiselect: true,
              folderselect: true,
              extensions: ['.pdf'],
            }
          );
          break;
      }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have tried to use &lt;STRONG&gt;dl=1&lt;/STRONG&gt; query param to force download files but nope not working!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 09:51:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/619685#M28539</guid>
      <dc:creator>HARITJOSHI1</dc:creator>
      <dc:date>2022-09-06T09:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Download files as blob using dropbox chooser</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/619767#M28541</link>
      <description>&lt;P&gt;Can you elaborate on what you mean when you say it's "not working"? What error or unexpected output do you get?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at the code you provided though, there's a few things to note:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;It looks like you're not setting the "linkType" &lt;A href="https://www.dropbox.com/developers/chooser" target="_blank"&gt;option&lt;/A&gt;, so it will default to "preview". In a case like this where you need to retrieve the file data programmatically, you should set "linkType" to "direct" so it will give you a temporary direct link to the file content, so you don't need to use the dl=1 option. (Also, note that if you do use &lt;A href="https://help.dropbox.com/files-folders/share/force-download" target="_blank"&gt;the dl=1 option&lt;/A&gt;, you should actually parse the URL and update the URL parameter, instead of just appending it as you are. Just appending it may not produce a properly formatted URL, as it may not replace any existing URL parameters.)&lt;/LI&gt;
&lt;LI&gt;You seem to be setting a Bearer token on the request to download the data, but this is not necessary or expected. These links don't take access tokens.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 01 Sep 2022 12:56:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/619767#M28541</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-09-01T12:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Download files as blob using dropbox chooser</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/620258#M28574</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/10"&gt;@Greg-DB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By "not working" I meant the error I was getting &lt;EM&gt;Access to XMLHttpRequest at &lt;STRONG&gt;&lt;A href="https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=0" target="_blank"&gt;https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=0&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;from origin &lt;STRONG&gt;&lt;A href="http://localhost:3000" target="_blank"&gt;http://localhost:3000&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp;has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have already set :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Redirect URIs=&lt;/STRONG&gt;&lt;STRONG&gt;&lt;A href="http://localhost:3000" target="_blank" rel="noopener"&gt;http://localhost:3000&lt;/A&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Choose&lt;/STRONG&gt;r&amp;nbsp; &lt;STRONG&gt;/ Saver / Embedder domains=localhost&amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;in the app console for my app for development purposes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have already tried to set&lt;STRONG&gt; linkType&lt;/STRONG&gt;&amp;nbsp;to &lt;STRONG&gt;"direct"&lt;/STRONG&gt; previously but then I got a pop-up box showing&lt;EM&gt; Uh oh! Seems like this widget is not configured properly.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Cannot enable both folder select and direct links.&amp;nbsp;&lt;/EM&gt;Before that everything was working except the issue I posted here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I also didn't get what you mean by URL parsing stuff.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Sep 2022 08:53:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/620258#M28574</guid>
      <dc:creator>HARITJOSHI1</dc:creator>
      <dc:date>2022-09-04T08:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Download files as blob using dropbox chooser</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/620734#M28618</link>
      <description>&lt;P&gt;I see, thanks for the additional information. Unfortunately the Dropbox Chooser doesn't support direct links for folders, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And Dropbox shared links on &lt;A href="http://www.dropbox.com" target="_blank"&gt;www.dropbox.com&lt;/A&gt; themselves unfortunately don't support CORS, so I'm afraid I don't have a good solution to offer here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, regarding the URL parsing, the code you shared could result in an incorrect URL like "&lt;A href="https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=0?dl=1&amp;quot;," target="_blank"&gt;https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=0?dl=1",&lt;/A&gt; instead of the correct "&lt;A href="https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=1&amp;quot;," target="_blank"&gt;https://www.dropbox.com/s/97110ukmvhj7s9s/SOME_PDF.pdf?dl=1",&lt;/A&gt; since you're just appending instead of replacing the URL parameter, if already present.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 13:31:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/620734#M28618</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-09-06T13:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Download files as blob using dropbox chooser</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/620829#M28644</link>
      <description>Ohh I actually tried to get around that but still got CORS error and I'm confused about direct and shared links they are not working in the way I want as you are saying it's a feature yet to implement then why url of the content is included as a response when a file is selected?&lt;BR /&gt;&lt;BR /&gt;What should I do is there any workaround that you can suggest??</description>
      <pubDate>Tue, 06 Sep 2022 19:58:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/620829#M28644</guid>
      <dc:creator>HARITJOSHI1</dc:creator>
      <dc:date>2022-09-06T19:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Download files as blob using dropbox chooser</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/620842#M28647</link>
      <description>&lt;P&gt;The "preview" links are typically meant for manual use, where CORS wouldn't be relevant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dropbox does also support those "dl" and "raw" parameters on preview/shared links, but that would only work in non-CORS environments, e.g., downloading a file on a server, not in a browser.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for a workaround, you would need to perform this in a non-CORS environment like, such as using a local non-browser client, like curl, or on a server of your own. That would be more work though. Apologies I don't have a better solution to offer.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 20:12:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Download-files-as-blob-using-dropbox-chooser/m-p/620842#M28647</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-09-06T20:12:21Z</dc:date>
    </item>
  </channel>
</rss>

