Browse Source

Merge pull request #231 from weseek/master

release v2.3.3
Yuki Takei 8 years ago
parent
commit
5fe2d6cfb9

+ 7 - 0
CHANGES.md

@@ -1,6 +1,13 @@
 CHANGES
 CHANGES
 ========
 ========
 
 
+## 2.3.3
+
+* Fix: The XSS Library escapes inline code blocks
+    * Degraded by 2.3.0
+* Fix: NPE occurs on Elasticsearch when initial access
+* Fix: Couldn't invite users(failed to create)
+
 ## 2.3.2
 ## 2.3.2
 
 
 * Improvement: Add LDAP group search options
 * Improvement: Add LDAP group search options

+ 4 - 2
lib/models/user.js

@@ -587,7 +587,7 @@ module.exports = function(crowi) {
       emailList,
       emailList,
       function(email, next) {
       function(email, next) {
         var newUser = new User()
         var newUser = new User()
-          ,password;
+          ,tmpUsername, password;
 
 
         email = email.trim();
         email = email.trim();
 
 
@@ -605,8 +605,10 @@ module.exports = function(crowi) {
             return next();
             return next();
           }
           }
 
 
+          tmpUsername = 'temp_' + Math.random().toString(36).slice(-16);
           password = Math.random().toString(36).slice(-16);
           password = Math.random().toString(36).slice(-16);
 
 
+          newUser.username = tmpUsername;
           newUser.email = email;
           newUser.email = email;
           newUser.setPassword(password);
           newUser.setPassword(password);
           newUser.createdAt = Date.now();
           newUser.createdAt = Date.now();
@@ -619,7 +621,7 @@ module.exports = function(crowi) {
                 password: null,
                 password: null,
                 user: null,
                 user: null,
               });
               });
-              debug('save failed!! ', email);
+              debug('save failed!! ', err);
             } else {
             } else {
               createdUserList.push({
               createdUserList.push({
                 email: email,
                 email: email,

+ 6 - 3
lib/util/search.js

@@ -207,13 +207,10 @@ SearchClient.prototype.deletePages = function(pages)
 SearchClient.prototype.addAllPages = function()
 SearchClient.prototype.addAllPages = function()
 {
 {
   var self = this;
   var self = this;
-  var offset = 0;
   var Page = this.crowi.model('Page');
   var Page = this.crowi.model('Page');
   var cursor = Page.getStreamOfFindAll();
   var cursor = Page.getStreamOfFindAll();
   var body = [];
   var body = [];
 
 
-  var counter = 0;
-
   return new Promise(function(resolve, reject) {
   return new Promise(function(resolve, reject) {
     cursor.on('data', function (doc) {
     cursor.on('data', function (doc) {
       if (!doc.creator || !doc.revision || !self.shouldIndexed(doc)) {
       if (!doc.creator || !doc.revision || !self.shouldIndexed(doc)) {
@@ -228,6 +225,12 @@ SearchClient.prototype.addAllPages = function()
     }).on('close', function () {
     }).on('close', function () {
       // all done
       // all done
 
 
+      // return if body is empty
+      // see: https://github.com/weseek/crowi-plus/issues/228
+      if (body.length == 0) {
+        return resolve();
+      }
+
       // 最後に送信
       // 最後に送信
       self.client.bulk({
       self.client.bulk({
         body: body,
         body: body,

+ 1 - 1
resource/js/components/HeaderSearchBox/SearchForm.js

@@ -121,7 +121,7 @@ export default class SearchForm extends React.Component {
           <InputGroup>
           <InputGroup>
             <AsyncTypeahead
             <AsyncTypeahead
               ref={ref => this._typeahead = ref}
               ref={ref => this._typeahead = ref}
-              name="q"
+              inputProps={{name: "q", autoComplete: "off"}}
               isLoading={this.state.isLoading}
               isLoading={this.state.isLoading}
               labelKey="path"
               labelKey="path"
               minLength={2}
               minLength={2}

+ 2 - 2
resource/js/util/interceptor/detach-code-blocks.js

@@ -40,8 +40,8 @@ export class DetachCodeBlockInterceptor extends BasicInterceptor {
 
 
     context.dcbContextMap = {};
     context.dcbContextMap = {};
 
 
-    // see: https://regex101.com/r/8PAEcC/1
-    context.markdown = markdown.replace(/```(.|[\r\n])*?```/gm, (all) => {
+    // see: https://regex101.com/r/8PAEcC/2
+    context.markdown = markdown.replace(/(```(.|[\r\n])*?```)|(`[^\r\n]*?`)/gm, (all) => {
       // create ID
       // create ID
       const replaceId = 'dcb-' + this.createRandomStr(8);
       const replaceId = 'dcb-' + this.createRandomStr(8);