Change:
Describe the bug Submitting the solution link as "" produces an error. Submitting "" does not. Whenever we submit a solution link "" it is appended with "/api/" so resultant solution gives "Not Found/Timeout error" and the same link submitted without "/" like "" gives solution as accepted. To Reproduce Steps to reproduce the behavior: to on 'solution input box' "https://freecodecamp-" solution gets accepted. "https://freecodecamp-" error Expected behavior This should be tackled as Chrome appends "/" by default to any domain URL you copy, so people who would copy URL from search bars will get URLs appended with "/" hence producing wrong results. This file shows the testString is directly appended with "/api" without checking if the input URL contains "/" at the end or not. Screenshots ! Desktop (please complete the following information): OS: Ubuntu 18 Browser: Google Chrome Version 73.0.3683.75
I am not having this problem - my project will pass the tests with or without the trailing https://fcc-manage-npm- and https://fcc-manage-npm- both pass for me in chrome Can you share a share a screen shot of the error?
Updated
hmm, it's strange that my project will give a good response when that string is appended but not yours https://fcc-manage-npm- - package as response https://freecodecamp- - not found as response not sure what is causing this - the only difference seems to be that I'm using glitch and you're using heroku in fact mine will work like this... https://fcc-manage-npm- so maybe how the two websites process a route or something? can they do that? glitch strips out the extra or something? weird Either way - I think a solution like you suggested would probably work - check if the submitted URL ends in a and remove it if it's there. This same problem probably occurs throughout the whole backend area all over the place.
Weird, would u check with an alternative hosting if the problem persists? If the problem persists the last solution would be stripping the las from input url
Did you try this Above is the actual link processed in the test with an appended , It gives a response with the same as it is shown in the screenshot I posted. So I guess the problem is with the routing of Heroku.

Discussion:
import PropTypes from 'prop-types'; import { reduxForm } from 'redux-form'; <del> import { FormFields, BlockSaveButton, BlockSaveWrapper } from './'; </del> <ins> import { FormFields, BlockSaveButton, BlockSaveWrapper, formatUrlValues } from './'; </ins> const propTypes = { buttonText: PropTypes.string,

return ( <form id={`dynamic-${id}`} <del> onSubmit={handleSubmit(submit)} </del> <ins> onSubmit={handleSubmit((values, ...args) => submit(formatUrlValues(values, options), ...args) )} </ins> style={{ width: '100%' }} > <FormFields

return value => (value ? fn(value) : value); } <ins> export function formatUrlValues(values, options) { return Object.keys(values).reduce((result, key) => { let value = values[key]; if (options.types[key] === 'url') { value = normalizeUrl(value, normalizeOptions); } return { ...result, [key]: value }; }, {}); } </ins> // formatUrl(url: String) => String export function formatUrl(url) { if (typeof url === 'string' && url.length > 4 && url.indexOf('.') !== -1) {

import PropTypes from 'prop-types'; import { Grid, Col, Row } from '@freecodecamp/react-bootstrap'; import { createSelector } from 'reselect'; <del> import { reduxForm } from 'redux-form'; </del> <ins> import { connect } from 'react-redux'; </ins> import { graphql } from 'gatsby'; <del> import normalizeUrl from 'normalize-url'; </del> import { executeChallenge,

import HelpModal from '../components/HelpModal'; import ProjectToolPanel from '../project/Tool-Panel'; import ProjectForm from '../project/ProjectForm'; <del> import { createFormValidator, isValidURL, makeRequired, Form } from '../../../components/formHelpers'; </del> <ins> import { Form } from '../../../components/formHelpers'; </ins> import Spacer from '../../../components/helpers/Spacer'; <ins> import { ChallengeNode } from '../../../redux/propTypes'; import { isSignedInSelector } from '../../../redux'; </ins> import { backend } from '../../../../utils/challengeTypes'; import '../components/test-frame.css'; <del> // provided by redux form const reduxFormPropTypes = { fields: PropTypes.object, handleSubmit: PropTypes.func.isRequired, resetForm: PropTypes.func.isRequired, submitting: PropTypes.bool }; </del> const propTypes = { challengeMounted: PropTypes.func.isRequired, <ins> data: PropTypes.shape({ challengeNode: ChallengeNode }), </ins> description: PropTypes.string, executeChallenge: PropTypes.func.isRequired, id: PropTypes.string, initTests: PropTypes.func.isRequired, <ins> isSignedIn: PropTypes.bool, </ins> output: PropTypes.string, <ins> pageContext: PropTypes.shape({ challengeMeta: PropTypes.object }), </ins> tests: PropTypes.array, title: PropTypes.string, updateBackendFormValues: PropTypes.func.isRequired, updateChallengeMeta: PropTypes.func.isRequired, <del> updateProjectFormValues: PropTypes.func.isRequired, ...reduxFormPropTypes }; const fields = ['solution']; const fieldValidators = { solution: makeRequired(isValidURL) </del> <ins> updateProjectFormValues: PropTypes.func.isRequired </ins> }; const mapStateToProps = createSelector( consoleOutputSelector, challengeTestsSelector, <del> (output, tests) => ({ </del> <ins> isSignedInSelector, (output, tests, isSignedIn) => ({ </ins> tests, <del> output </del> <ins> output, isSignedIn </ins> }) );

handleSubmit(values) { const { updateBackendFormValues, executeChallenge } = this.props; <del> values.solution = normalizeUrl(values.solution); </del> updateBackendFormValues(values); executeChallenge(); }

}, output, tests, <del> submitting, </del> <ins> isSignedIn, </ins> executeChallenge, updateProjectFormValues } = this.props; <del> // TODO: Should be tied to user.isSignedIn const buttonCopy = submitting </del> <ins> const buttonCopy = isSignedIn </ins> ? 'Submit and go to my next challenge' : "I've completed this challenge"; const blockNameTitle = `${blockName} - ${title}`;

BackEnd.displayName = 'BackEnd'; BackEnd.propTypes = propTypes; <del> export default reduxForm( { form: 'BackEndChallenge', fields, validate: createFormValidator(fieldValidators) }, </del> <ins> export default connect( </ins> mapStateToProps, mapDispatchToActions )(BackEnd);