File tree Expand file tree Collapse file tree
pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class ConfigHistoryRevision extends Model {
3030 help_text: 'The configuration version associated with this change. ' ,
3131 );
3232 $ this ->filesize = new IntegerField (
33- default: 0 ,
33+ default: - 1 ,
3434 help_text: 'The file size (in bytes) of the configuration file associated with this change. ' ,
3535 );
3636
@@ -42,8 +42,18 @@ class ConfigHistoryRevision extends Model {
4242 * @return array The configuration history as an array of objects.
4343 */
4444 protected function get_config_history (): array {
45+ # Get our current configuration history, but remove the versions key. These are not needed for the Model.
4546 $ config_history = get_backups ();
4647 unset($ config_history ['versions ' ]);
48+
49+ # Loop through each entry in the configuration history and normalize the data
50+ foreach ($ config_history as &$ entry ) {
51+ # If filesize is not a numeric, set it to the default
52+ if (!is_numeric ($ entry ['filesize ' ])) {
53+ $ entry ['filesize ' ] = $ this ->filesize ->default ;
54+ }
55+ }
56+
4757 return $ config_history ;
4858 }
4959
You can’t perform that action at this time.
0 commit comments