Skip to content

Commit 19a0922

Browse files
Merge pull request #750 from jaredhendrickson13/next_patch
v2.6.1 Fixes
2 parents b1293cc + 3f9696a commit 19a0922

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Fields/SpecialNetworkField.inc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,14 @@ class SpecialNetworkField extends InterfaceField {
307307
return $representation_value;
308308
}
309309

310-
# If the value is a NetworkInterface, obtain its representation value if it's not the ID
311-
$if_query = NetworkInterface::query(id: $internal_value);
312-
if ($this->represented_as !== 'id' and NetworkInterface::query(id: $internal_value)->exists()) {
313-
return $if_query->first()->{$this->represented_as}->value;
310+
# When loading the regular internal value (from InterfaceField), if the value is different from the
311+
# internal value, it means it was an interface that got converted from its internal ID. So return it.
312+
$representation_value = parent::_from_internal($internal_value);
313+
if ($representation_value !== $internal_value) {
314+
return $representation_value;
314315
}
315316

316-
# Otherwise, just return the internal value as it is
317+
# Otherwise, just return the internal value as it is (interface ID, alias, IP, subnet, keyword, etc.)
317318
return $internal_value;
318319
}
319320
}

0 commit comments

Comments
 (0)