@@ -22,7 +22,7 @@ import MatrixClientPeg from '../../../MatrixClientPeg';
2222import sdk from '../../../index' ;
2323import { decryptFile } from '../../../utils/DecryptFile' ;
2424import Tinter from '../../../Tinter' ;
25- import 'isomorphic-fetch ';
25+ import request from 'browser-request ';
2626import q from 'q' ;
2727import Modal from '../../../Modal' ;
2828
@@ -41,10 +41,13 @@ function updateTintedDownloadImage() {
4141 // Download the svg as an XML document.
4242 // We could cache the XML response here, but since the tint rarely changes
4343 // it's probably not worth it.
44- q ( fetch ( "img/download.svg" ) ) . then ( function ( response ) {
45- return response . text ( ) ;
46- } ) . then ( function ( svgText ) {
47- const svg = new DOMParser ( ) . parseFromString ( svgText , "image/svg+xml" ) ;
44+ // Also note that we can't use fetch here because fetch doesn't support
45+ // file URLs, which the download image will be if we're running from
46+ // the filesystem (like in an Electron wrapper).
47+ request ( { uri : "img/download.svg" } , ( err , response , body ) => {
48+ if ( err ) return ;
49+
50+ const svg = new DOMParser ( ) . parseFromString ( body , "image/svg+xml" ) ;
4851 // Apply the fixups to the XML.
4952 const fixups = Tinter . calcSvgFixups ( [ { contentDocument : svg } ] ) ;
5053 Tinter . applySvgFixups ( fixups ) ;
@@ -55,7 +58,7 @@ function updateTintedDownloadImage() {
5558 Object . keys ( mounts ) . forEach ( function ( id ) {
5659 mounts [ id ] . tint ( ) ;
5760 } ) ;
58- } ) . done ( ) ;
61+ } ) ;
5962}
6063
6164Tinter . registerTintable ( updateTintedDownloadImage ) ;
0 commit comments