Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/common/task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Future<VM2<String, String>> _makeRealProfileTask(

rawConfig['external-controller'] = realPatchConfig.externalController.value;
rawConfig['external-ui'] = '';
rawConfig['interface-name'] = '';
rawConfig['interface-name'] ??= '';
rawConfig['external-ui-url'] = '';
rawConfig['tcp-concurrent'] = realPatchConfig.tcpConcurrent;
rawConfig['unified-delay'] = realPatchConfig.unifiedDelay;
Expand Down
38 changes: 38 additions & 0 deletions test/common/task_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,44 @@ void main() {
}
});

test('profile output preserves an explicit interface name', () async {
final profile = await makeRealProfileTask(
const MakeRealProfileState(
profilesPath: '/tmp/flclash-interface-name-test',
profileId: 14,
rawConfig: {'interface-name': 'Campus PPPoE'},
realPatchConfig: PatchClashConfig(),
overrideDns: false,
appendSystemDns: false,
proxyGroups: [],
rules: [],
addedRules: [],
defaultUA: 'FlClash-Test',
),
);

expect(profile.a, contains('interface-name: "Campus PPPoE"'));
});

test('profile output keeps an unset interface name empty', () async {
final profile = await makeRealProfileTask(
const MakeRealProfileState(
profilesPath: '/tmp/flclash-interface-name-test',
profileId: 15,
rawConfig: {},
realPatchConfig: PatchClashConfig(),
overrideDns: false,
appendSystemDns: false,
proxyGroups: [],
rules: [],
addedRules: [],
defaultUA: 'FlClash-Test',
),
);

expect(profile.a, contains('interface-name: ""'));
});

test(
'DNS overwrite does not append system DNS when the setting is disabled',
() async {
Expand Down
Loading