Skip to content

Commit 4dab36d

Browse files
authored
Merge pull request element-hq#2541 from vector-im/dbkr/blank_config_3
Better support no-config when loading from file
2 parents c1469f4 + cfe63fa commit 4dab36d

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎src/vector/index.js‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,15 @@ function getConfig() {
179179
if (err || response.status < 200 || response.status >= 300) {
180180
// Lack of a config isn't an error, we should
181181
// just use the defaults.
182-
// Also treat a blank config as no config because
183-
// we don't get 404s from file: URIs so this is the
184-
// only way we can not fail if the file doesn't exist
185-
// when loading from a file:// URI.
186-
if (( response && response.status == 404) || body == '') {
187-
deferred.resolve({});
182+
// Also treat a blank config as no config, assuming
183+
// the status code is 0, because we don't get 404s
184+
// from file: URIs so this is the only way we can
185+
// not fail if the file doesn't exist when loading
186+
// from a file:// URI.
187+
if (response) {
188+
if (response.status == 404 || (response.status == 0 && body == '')) {
189+
deferred.resolve({});
190+
}
188191
}
189192
deferred.reject({err: err, response: response});
190193
return;

0 commit comments

Comments
 (0)