Skip to content

Commit

Permalink
fix: bug when running shorten with no arguments (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebJones committed May 29, 2020
1 parent 0c46bed commit fce639c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ if (codeRaw) {
const short = `/${code || generateCode()}`
const contents = fs.readFileSync(redirectPath, 'utf8')

const formattedLink = addProtocolIfMissing(longLink)

let newContents = contents
if (formattedLink) {
let formattedLink = null
if (longLink) {
formattedLink = addProtocolIfMissing(longLink)
validateUrl(formattedLink)
validateUnique(short, contents)
newContents = `${short} ${formattedLink}\n${contents}`
Expand Down

0 comments on commit fce639c

Please sign in to comment.