-
Notifications
You must be signed in to change notification settings - Fork 13
Conversation
/retest |
app-connector-client/server/app.js
Outdated
var img_path = path.resolve(__dirname, 'views/static/logo.svg') | ||
if (varkesConfig.logo) { | ||
img_path = varkesConfig.logo; | ||
var tmp = img_path.split(".") |
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.
The splitting by dot is a bit naive.. what if the file name contains a dot..
That all guessing of content type dependent on image is maybe a bit too much Either we use a library or maybe let's fix the supported types to "svg" only. Then we have no problem with image scaling and we don't have to do magic.
So if a mock wants a custom logo, then it must be provided in svg. Letzt have just a config validation to assure it and we are done.
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.
Ok I could limit it to svg only . but the dot will work as long as it's an image file because I am taking the content after the last dot
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.
hmm.. that is an argument :)
However, am afraid that other formats will always end up in bad rendering as we do not specify size and are not scaling..
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.
I have allowed only svg and added a validation in the config.js file
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.
see my comments
@@ -56,6 +56,9 @@ function configValidation(configJson) { | |||
} | |||
} | |||
} | |||
if (configJson.logo && !configJson.logo.match(/^.+\.(svg)$/)) { | |||
error_message += "\nlogo image must be in svg format" |
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.
Repeat the actual value, that helps finding the problem. Print the actual pattern to easily see where the problem is
error_message += "\nlogo image must be in svg format" | |
error_message += "\nlogo " + configJson.logo + " must be a path to an image in svg format, matching pattern '^.+\.(svg)$'" |
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.
Please see my one minor comment
adding a logo beside the title Issue #147