-
-
Notifications
You must be signed in to change notification settings - Fork 2
Assets folder recognition fix #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assets folder recognition fix #3
Conversation
validations/assets.js
Outdated
@@ -89,7 +89,8 @@ function validateSVGFiles(article){ | |||
* @returns an array of ValidationIssue objects for the found issues. | |||
*/ | |||
function validateAssetsFolderName(article){ | |||
if(article.assets.length > 0 && article.assetsFolder === null){ | |||
|
|||
if(article.assets.length > 0 && article.assetsFolder != "assets"){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the behavior. "images" should also be allowed. Those cases should be handled by the assetsFolder
property. If it doesn't return null, the problem is elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then on the assetsFolder
function
// Try to figure out assets path from the referenced images
const usedAssetPaths = this.referencedImages.map((assetPath) => {
const directory = path.dirname(assetPath)
if(!directory) return null;
return directory.split("/")[0]; // <-- This returns the "wrong" assets folder name
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assetsFolder
just returns the folder, it doesnt matter the name, in the assets.js
should be the logic which determines if it is correct or not, isnt it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marqdevx You're right. Let me push a commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
validateAssetsFolderName
fixed scenario: when it is null it does not mean the name is correct