fix: Settings page picture url fix (#55673)

This commit is contained in:
Gagan Bhullar
2024-07-30 01:22:38 -06:00
committed by GitHub
parent 2e9e42c74e
commit 9090c0803f
3 changed files with 7 additions and 3 deletions

View File

@@ -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')

View File

@@ -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 : ''
}
});

View File

@@ -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({