Skip to content
This repository was archived by the owner on Mar 16, 2021. It is now read-only.

Commit f6e7e6f

Browse files
committed
fixed not cleaned up and displayed shorted URL (#120)
1 parent 7968d47 commit f6e7e6f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

internal/handlers/public.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func (h *Handler) handleCreate(c *gin.Context) {
117117
}
118118
originURL := h.getURLOrigin(c)
119119
c.JSON(http.StatusOK, requestHelper{
120+
ID: id,
120121
URL: fmt.Sprintf("%s/%s", originURL, id),
121122
DeletionURL: fmt.Sprintf("%s/d/%s/%s", originURL, id, url.QueryEscape(base64.RawURLEncoding.EncodeToString(delID))),
122123
})

web/src/Home/Home.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export default class HomeComponent extends Component {
3333
this.setState({ usedSettings: value })
3434
}
3535

36-
3736
componentDidMount() {
3837
this.urlInput.focus()
3938
util.getDisplayURL()
@@ -43,12 +42,12 @@ export default class HomeComponent extends Component {
4342
if (!this.state.showCustomIDError) {
4443
util.createEntry({
4544
URL: this.url,
46-
ID: this.state.customID,
45+
ID: this.state.usedSettings.includes("custom") ? this.state.customID : undefined,
4746
Expiration: this.state.usedSettings.includes("expire") && this.state.expiration ? this.state.expiration.toISOString() : undefined,
4847
Password: this.state.usedSettings.includes("protected") && this.password ? this.password : undefined
4948
}, r => this.setState({
5049
links: [...this.state.links, {
51-
shortenedURL: this.state.displayURL + "/" + this.state.customID,
50+
shortenedURL: this.state.displayURL + "/" + r.ID,
5251
originalURL: this.url,
5352
expiration: this.state.usedSettings.includes("expire") && this.state.expiration ? this.state.expiration.toISOString() : undefined,
5453
deletionURL: r.DeletionURL

0 commit comments

Comments
 (0)