Skip to content

Commit a6337ca

Browse files
committed
nassh: fix handling of default port settings
The default port value is null, not "". When the port field is empty, it will be an empty string which means we end up storing "" everywhere instead of eliding it entirely. Change it around to null instead. This doesn't automatically clear out existing prefs, but it should get cleared whenever the user displays/tweaks a specific connection. Change-Id: I4e7fa0ccd1894df81f294b48fe4e054d44c23c84 Reviewed-on: https://chromium-review.googlesource.com/c/1352192 Reviewed-by: Vitaliy Shipitsyn <[email protected]> Tested-by: Mike Frysinger <[email protected]>
1 parent b5f9744 commit a6337ca

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

nassh/js/nassh_connect_dialog.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,13 @@ nassh.ConnectDialog.prototype.save = function() {
373373

374374
var value = this.$f(name).value;
375375

376-
if (name == 'port')
377-
value = value ? parseInt(value) : '';
376+
if (name == 'port') {
377+
value = parseInt(value);
378+
if (!value) {
379+
// If parsing failed for any reason, reset it to the default.
380+
value = null;
381+
}
382+
}
378383

379384
if ((!prefs && !value) || (prefs && value == prefs.get(name)))
380385
return;

0 commit comments

Comments
 (0)