mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-20 12:03:11 -04:00
fix: Settings page picture url fix (#55673)
This commit is contained in:
@@ -179,7 +179,7 @@ function updateMyAbout(req, res, next) {
|
||||
// prevent dataurls from being stored
|
||||
const update = isURL(picture, { require_protocol: true })
|
||||
? { name, location, about, picture }
|
||||
: { name, location, about };
|
||||
: { name, location, about, picture: '' };
|
||||
return user.updateAttributes(
|
||||
update,
|
||||
createStandardHandler(req, res, next, 'flash.updated-about-me')
|
||||
|
||||
@@ -494,7 +494,7 @@ ${isLinkSentWithinLimitTTL}`
|
||||
about: req.body.about,
|
||||
name: req.body.name,
|
||||
location: req.body.location,
|
||||
...(hasProtocol && { picture: req.body.picture })
|
||||
picture: hasProtocol ? req.body.picture : ''
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -165,7 +165,11 @@ class AboutSettings extends Component<AboutProps, AboutState> {
|
||||
|
||||
handlePictureChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const value = (e.target as HTMLInputElement).value.slice(0);
|
||||
if (isURL(value, { require_protocol: true })) {
|
||||
if (!value) {
|
||||
this.setState({
|
||||
isPictureUrlValid: true
|
||||
});
|
||||
} else if (isURL(value, { require_protocol: true })) {
|
||||
this.validationImage.src = encodeURI(value);
|
||||
} else {
|
||||
this.setState({
|
||||
|
||||
Reference in New Issue
Block a user