Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix #1080 - add check on min length when choosing custom link.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Mar 15, 2016
1 parent b44269e commit c8765b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/src/plugins/action.share/class.ShareLink.php
Expand Up @@ -162,6 +162,9 @@ public function parseHttpVars($httpVars){
// Existing already
$value = AJXP_Utils::sanitize($httpVars["custom_handle"], AJXP_SANITIZE_ALPHANUM);
$value = strtolower($value);
if(strlen($value) < $this->store->hashMinLength){
throw new Exception("Custom link is too short, please use at least ".$this->store->hashMinLength." characters");
}
$test = $this->store->loadShare($value);
$mess = ConfService::getMessages();
if(!empty($test)) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/action.share/res/react/ShareDialog.js
Expand Up @@ -855,7 +855,7 @@
return (
<div className="public-link-container edit-link">
<span>{publicLink.split('://')[0]}://[..]/{PathUtils.getBasename(PathUtils.getDirname(publicLink)) + '/'}</span>
<ReactMUI.TextField onChange={this.changeLink} value={this.state.customLink || this.props.linkData['hash']}/>
<ReactMUI.TextField onChange={this.changeLink} value={this.state.customLink !== undefined ? this.state.customLink : this.props.linkData['hash']}/>
<ReactMUI.RaisedButton label="Ok" onClick={this.toggleEditMode}/>
<div className="section-legend">{this.context.getMessage('194')}</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions core/src/plugins/action.share/res/react/model/ShareModel.js
Expand Up @@ -502,6 +502,9 @@
/* CUSTOM LINK HANDLE */
/**********************/
updateCustomLink(linkId, newValue){
if(newValue == linkId){
return;
}
this._initPendingData();
this._pendingData['links'][linkId]['custom_link'] = newValue;
this.save();
Expand Down

0 comments on commit c8765b5

Please sign in to comment.