Closed alammoiz closed 2 years ago
I have updated the schema, please try with url not text @Ananto30
ref: createPost now takes text in body, replace that with url
Oh sorry, my mistake 🙏
After changing it to url
-
I think just includes
won't suffice const isAdultUrl = adultURLs.includes(value);
Still not working 😟
I think we can check this inside the controller method createPost
. And please test before pushing 🙏
You need to add not()
and this works
body("url", "Adult contents are not allowed").not().isIn(adultURLs)
But only for the exact match, like if I put exactly "https://www.timeout.com"
So this is not the solution I think. If the express-validator cannot do this, we can always write a method to do that 😃
Still not working 😟 I think we can check this inside the controller method
createPost
. And please test before pushing 🙏You need to add
not()
and this worksbody("url", "Adult contents are not allowed").not().isIn(adultURLs)
But only for the exact match, like if I put exactly "https://www.timeout.com"
So this is not the solution I think. If the express-validator cannot do this, we can always write a method to do that 😃
You're Right. But I'm not an expert in express-validator. So, I have pushed the code with only this fix that you have mentioned. Can you please merge this PR or open another ticket of custom validation for url. I shall be very thankful if you could do this. 😃
Or can you please help me?
Thanks @alammoiz Rest of the task transferred to https://github.com/Ananto30/golpo-express/issues/14
It's not working 😟 Am I missing something?