Browse Source

fixed not cleaned up and displayed shorted URL (#120)

dependabot/npm_and_yarn/web/prismjs-1.21.0
Max Schmitt 7 years ago
parent
commit
f6e7e6fd9f
  1. 1
      internal/handlers/public.go
  2. 5
      web/src/Home/Home.js

1
internal/handlers/public.go

@ -117,6 +117,7 @@ func (h *Handler) handleCreate(c *gin.Context) {
}
originURL := h.getURLOrigin(c)
c.JSON(http.StatusOK, requestHelper{
ID: id,
URL: fmt.Sprintf("%s/%s", originURL, id),
DeletionURL: fmt.Sprintf("%s/d/%s/%s", originURL, id, url.QueryEscape(base64.RawURLEncoding.EncodeToString(delID))),
})

5
web/src/Home/Home.js

@ -33,7 +33,6 @@ export default class HomeComponent extends Component {
this.setState({ usedSettings: value })
}
componentDidMount() {
this.urlInput.focus()
util.getDisplayURL()
@ -43,12 +42,12 @@ export default class HomeComponent extends Component {
if (!this.state.showCustomIDError) {
util.createEntry({
URL: this.url,
ID: this.state.customID,
ID: this.state.usedSettings.includes("custom") ? this.state.customID : undefined,
Expiration: this.state.usedSettings.includes("expire") && this.state.expiration ? this.state.expiration.toISOString() : undefined,
Password: this.state.usedSettings.includes("protected") && this.password ? this.password : undefined
}, r => this.setState({
links: [...this.state.links, {
shortenedURL: this.state.displayURL + "/" + this.state.customID,
shortenedURL: this.state.displayURL + "/" + r.ID,
originalURL: this.url,
expiration: this.state.usedSettings.includes("expire") && this.state.expiration ? this.state.expiration.toISOString() : undefined,
deletionURL: r.DeletionURL

Loading…
Cancel
Save