From 36bb1d41df69a313c6bac5d7ea806fae09a167df Mon Sep 17 00:00:00 2001 From: gregorybesson Date: Sun, 17 Sep 2017 06:02:31 -0700 Subject: [PATCH] fix: bug on rgeex when end of the file name was -abe --- src/cli/cms/data/attr.js | 6 ++---- tests/unit/cms/data/attr.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/cli/cms/data/attr.js b/src/cli/cms/data/attr.js index d5f0fe77..ebb262b0 100755 --- a/src/cli/cms/data/attr.js +++ b/src/cli/cms/data/attr.js @@ -1,8 +1,6 @@ import {cmsData} from '../../' -var fullAttr = '-abe-(.+?)(?=.' -var captureAttr = '-abe-(.+?)(?=.' - +const captureAttr = '-abe-([a-z A-Z]{1}[0-9]{1}.+?)(?=.' /** * Class Attr * Work string to manage string attributes key/value @@ -39,7 +37,7 @@ export default class Attr { remove() { if (this.str != null) { return this.str.replace( - new RegExp(fullAttr + this.getExtension() + ')'), + new RegExp(captureAttr + this.getExtension() + ')'), '' ) } diff --git a/tests/unit/cms/data/attr.js b/tests/unit/cms/data/attr.js index 5873bf37..6fcf5de8 100644 --- a/tests/unit/cms/data/attr.js +++ b/tests/unit/cms/data/attr.js @@ -27,7 +27,7 @@ describe('Attr', function() { * */ it('new attr', function() { - var attr = new cmsData.attr("article-abe-d20160920T125255138Z.shtml") + var attr = new cmsData.attr("article-mon-abe-abe-d20160920T125255138Z.shtml") chai.expect(attr.str).to.not.be.undefined; chai.expect(attr.val.s).to.not.be.undefined; chai.expect(attr.val.s).to.be.equal('d');