ignore undefined asset strings
There are specs which do not appropriately provide an asset string and consequently explode in hard-to-debug ways. Since this function can already return undefined, providing a default empty string does not impact the behavior. There are no specs for this function, sadly. test plan: * Verify Jenkins passes Change-Id: Ibba39fce03ab8cedd5e275887366db0ec4dfa482 Reviewed-on: https://gerrit.instructure.com/149241 Reviewed-by: Spencer Olson <solson@instructure.com> Tested-by: Jenkins Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com> Product-Review: Jeremy Neander <jneander@instructure.com> QA-Review: Jeremy Neander <jneander@instructure.com>
This commit is contained in:
parent
96e7f9187e
commit
3f0629e9bd
|
@ -17,7 +17,7 @@
|
|||
|
||||
import pluralize from 'str/pluralize'
|
||||
|
||||
export default function splitAssetString (assetString, toPlural = true) {
|
||||
export default function splitAssetString (assetString = '', toPlural = true) {
|
||||
const match = assetString.match(/(.*)_(\d+)$/)
|
||||
if (match) {
|
||||
const contextType = toPlural ? pluralize(match[1]) : match[1]
|
||||
|
|
Loading…
Reference in New Issue