Merge branch 'master' of https://github.com/mattermost/platform into mm-1762
Этот коммит содержится в:
@@ -33,7 +33,7 @@ func InitFile(r *mux.Router) {
|
|||||||
|
|
||||||
sr := r.PathPrefix("/files").Subrouter()
|
sr := r.PathPrefix("/files").Subrouter()
|
||||||
sr.Handle("/upload", ApiUserRequired(uploadFile)).Methods("POST")
|
sr.Handle("/upload", ApiUserRequired(uploadFile)).Methods("POST")
|
||||||
sr.Handle("/get/{channel_id:[A-Za-z0-9]+}/{user_id:[A-Za-z0-9]+}/{filename:([A-Za-z0-9]+/)?.+\\.[A-Za-z0-9]{3,}}", ApiAppHandler(getFile)).Methods("GET")
|
sr.Handle("/get/{channel_id:[A-Za-z0-9]+}/{user_id:[A-Za-z0-9]+}/{filename:([A-Za-z0-9]+/)?.+(\\.[A-Za-z0-9]{3,})?}", ApiAppHandler(getFile)).Methods("GET")
|
||||||
sr.Handle("/get_public_link", ApiUserRequired(getPublicLink)).Methods("POST")
|
sr.Handle("/get_public_link", ApiUserRequired(getPublicLink)).Methods("POST")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -319,6 +319,6 @@ func ClearMentionTags(post string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var UrlRegex = regexp.MustCompile(`^((?:[a-z]+:\/\/)?(?:(?:[a-z0-9\-]+\.)+(?:[a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(?:\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(?:\?[a-z0-9+_~\-\.%=&]*)?)?(?:#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(?:\s+|$)$`)
|
var UrlRegex = regexp.MustCompile(`^((?:[a-z]+:\/\/)?(?:(?:[a-z0-9\-]+\.)+(?:[a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(?:\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(?:\?[a-z0-9+_~\-\.%=&]*)?)?(?:#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(?:\s+|$)$`)
|
||||||
var PartialUrlRegex = regexp.MustCompile(`/([A-Za-z0-9]{26})/([A-Za-z0-9]{26})/((?:[A-Za-z0-9]{26})?.+\.[A-Za-z0-9]{3,})`)
|
var PartialUrlRegex = regexp.MustCompile(`/([A-Za-z0-9]{26})/([A-Za-z0-9]{26})/((?:[A-Za-z0-9]{26})?.+(?:\.[A-Za-z0-9]{3,})?)`)
|
||||||
|
|
||||||
var SplitRunes = map[rune]bool{',': true, ' ': true, '.': true, '!': true, '?': true, ':': true, ';': true, '\n': true, '<': true, '>': true, '(': true, ')': true, '{': true, '}': true, '[': true, ']': true, '+': true, '/': true, '\\': true}
|
var SplitRunes = map[rune]bool{',': true, ' ': true, '.': true, '!': true, '?': true, ':': true, ';': true, '\n': true, '<': true, '>': true, '(': true, ')': true, '{': true, '}': true, '[': true, ']': true, '+': true, '/': true, '\\': true}
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ func (ss SqlStore) CreateFullTextIndexIfNotExists(indexName string, tableName st
|
|||||||
func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, columnName string, fullText bool) {
|
func (ss SqlStore) createIndexIfNotExists(indexName string, tableName string, columnName string, fullText bool) {
|
||||||
|
|
||||||
if utils.Cfg.SqlSettings.DriverName == "postgres" {
|
if utils.Cfg.SqlSettings.DriverName == "postgres" {
|
||||||
_, err := ss.GetMaster().SelectStr("SELECT to_regclass($1)", indexName)
|
_, err := ss.GetMaster().SelectStr("SELECT $1::regclass", indexName)
|
||||||
// It should fail if the index does not exist
|
// It should fail if the index does not exist
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ module.exports = React.createClass({
|
|||||||
} else if (i < Constants.MAX_DISPLAY_FILES) {
|
} else if (i < Constants.MAX_DISPLAY_FILES) {
|
||||||
postFiles.push(
|
postFiles.push(
|
||||||
<div className="post-image__column custom-file" key={fileInfo.name+i}>
|
<div className="post-image__column custom-file" key={fileInfo.name+i}>
|
||||||
<a href={fileInfo.path+"."+fileInfo.ext} download={fileInfo.name+"."+fileInfo.ext}>
|
<a href={fileInfo.path + (fileInfo.ext ? "." + fileInfo.ext : "")} download={fileInfo.name + (fileInfo.ext ? "." + fileInfo.ext : "")}>
|
||||||
<div className={"file-icon "+utils.getIconClassName(type)}/>
|
<div className={"file-icon "+utils.getIconClassName(type)}/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -546,10 +546,13 @@ module.exports.getIconClassName = function(fileType) {
|
|||||||
|
|
||||||
module.exports.splitFileLocation = function(fileLocation) {
|
module.exports.splitFileLocation = function(fileLocation) {
|
||||||
var fileSplit = fileLocation.split('.');
|
var fileSplit = fileLocation.split('.');
|
||||||
if (fileSplit.length < 2) return {};
|
|
||||||
|
|
||||||
var ext = fileSplit[fileSplit.length-1];
|
var ext = "";
|
||||||
fileSplit.splice(fileSplit.length-1,1)
|
if (fileSplit.length > 1) {
|
||||||
|
ext = fileSplit[fileSplit.length - 1];
|
||||||
|
fileSplit.splice(fileSplit.length - 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
var filePath = fileSplit.join('.');
|
var filePath = fileSplit.join('.');
|
||||||
var filename = filePath.split('/')[filePath.split('/').length-1];
|
var filename = filePath.split('/')[filePath.split('/').length-1];
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user