fix(legacy): sanitize track_type_id when updating file (#2003)
Fixes #2000
This commit is contained in:
parent
e6d24333cb
commit
f137be09a1
|
@ -49,6 +49,9 @@ class FileDataHelper
|
|||
// This will convert floats to ints too.
|
||||
$data['bpm'] = intval($data['bpm']);
|
||||
}
|
||||
if (array_key_exists('track_type_id', $data)) {
|
||||
$data['track_type_id'] = intval($data['track_type_id']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -229,6 +229,12 @@ class Application_Model_StoredFile
|
|||
if ($dbColumn == 'track_number' && empty($mdValue)) {
|
||||
$mdValue = null;
|
||||
}
|
||||
|
||||
// We need to set track_type_id to null if it is an empty string or 0
|
||||
if ($dbColumn == 'track_type_id' && ($mdValue == 0 || empty($mdValue))) {
|
||||
$mdValue = null;
|
||||
}
|
||||
|
||||
$this->_file->{$method}($mdValue);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue