@@ -22,7 +22,7 @@ import MatrixClientPeg from '../../../MatrixClientPeg';
22
22
import sdk from '../../../index' ;
23
23
import { decryptFile } from '../../../utils/DecryptFile' ;
24
24
import Tinter from '../../../Tinter' ;
25
- import 'isomorphic-fetch ';
25
+ import request from 'browser-request ';
26
26
import q from 'q' ;
27
27
import Modal from '../../../Modal' ;
28
28
@@ -41,10 +41,13 @@ function updateTintedDownloadImage() {
41
41
// Download the svg as an XML document.
42
42
// We could cache the XML response here, but since the tint rarely changes
43
43
// 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" ) ;
48
51
// Apply the fixups to the XML.
49
52
const fixups = Tinter . calcSvgFixups ( [ { contentDocument : svg } ] ) ;
50
53
Tinter . applySvgFixups ( fixups ) ;
@@ -55,7 +58,7 @@ function updateTintedDownloadImage() {
55
58
Object . keys ( mounts ) . forEach ( function ( id ) {
56
59
mounts [ id ] . tint ( ) ;
57
60
} ) ;
58
- } ) . done ( ) ;
61
+ } ) ;
59
62
}
60
63
61
64
Tinter . registerTintable ( updateTintedDownloadImage ) ;
0 commit comments