Skip to content
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

server error when trying to update social links at dev environment #54586

Closed
shootermv opened this issue Apr 30, 2024 · 5 comments
Closed

server error when trying to update social links at dev environment #54586

shootermv opened this issue Apr 30, 2024 · 5 comments
Labels
status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.

Comments

@shootermv
Copy link
Contributor

Describe the Issue

server error when trying to update social links (Internet Presence) at dev environment

Affected Page

settings

Steps to Reproduce

  1. start dev server 'pnpm run develop'
  2. Click on 'settings'
  3. Scroll down to 'Your Internet Presence'
  4. fill all the 4 fields with some data
  5. Press 'save'
  6. you will See error (if you have 'network' tab at developer tool open, you will see the error status is 403 )

Expected behavior

social links data should be saved

Screenshots

image

System

  • Device: [desktop]
  • OS: [WSL2, Windows 10, Ubuntu 20.04]
  • Browser: [Chrome]
  • Version: [e.g. 22]

Additional context

No response

@shootermv shootermv added status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. labels Apr 30, 2024
@ShaunSHamilton
Copy link
Member

ShaunSHamilton commented May 1, 2024

I cannot reproduce any errors here.

Were you signed in with a previous session? Did you recently hard refresh the page and run pnpm run seed?


EDIT: I see you can get an error putting in the wrong domains:

const allowedSocialsAndDomains = {
githubProfile: 'github.com',
linkedin: 'linkedin.com',
twitter: 'twitter.com',
website: ''
};
const socialVals = Object.keys(allowedSocialsAndDomains);
export function updateMySocials(...args) {
const buildUpdate = body => _.pick(body, socialVals);
const validate = update => {
// Socials should point to their respective domains
// or be empty strings
return Object.keys(update).every(key => {
const val = update[key];
if (val === '') {
return true;
}
if (key === 'website') {
return isURL(val, { require_protocol: true });
}
const domain = allowedSocialsAndDomains[key];
try {
const url = new URL(val);
const topDomain = url.hostname.split('.').slice(-2);
if (topDomain.length === 2) {
return topDomain.join('.') === domain;
}
return false;
} catch (e) {
return false;
}
});
};
createUpdateUserProperties(
buildUpdate,
validate,
'flash.updated-socials'
)(...args);
}

@shootermv
Copy link
Contributor Author

I must note that i was able to send and save 'about' data (form located at same page) ...

@huyenltnguyen
Copy link
Member

@shootermv What are the values you entered into the inputs?

The UI doesn't validate the domain, but the server does, and:

  • The GitHub input only accepts a URL starting with github.com
  • The LinkedIn input only accepts a URL starting with linkedin.com
  • The Twitter input only accepts a URL starting with twitter.com

@shootermv
Copy link
Contributor Author

ok, it looks like i had a space between parts of one urls:

image

@huyenltnguyen
Copy link
Member

That would be considered an invalid value then, and the server erroring out is expected.

I'm going to close the issue since there is no further action to make.

@huyenltnguyen huyenltnguyen closed this as not planned Won't fix, can't repro, duplicate, stale May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.
Projects
None yet
Development

No branches or pull requests

3 participants