@@ -124,8 +124,6 @@ module.exports = function (sequelize, DataTypes) {
124124 var body = fs . readFileSync ( filePath , 'utf8' ) ;
125125 var contentLength = body . length ;
126126 var title = Note . parseNoteTitle ( body ) ;
127- body = LZString . compressToBase64 ( body ) ;
128- title = LZString . compressToBase64 ( title ) ;
129127 if ( fsModifiedTime . isAfter ( dbModifiedTime ) && note . content !== body ) {
130128 note . update ( {
131129 title : title ,
@@ -135,14 +133,14 @@ module.exports = function (sequelize, DataTypes) {
135133 sequelize . models . Revision . saveNoteRevision ( note , function ( err , revision ) {
136134 if ( err ) return _callback ( err , null ) ;
137135 // update authorship on after making revision of docs
138- var patch = dmp . patch_fromText ( LZString . decompressFromBase64 ( revision . patch ) ) ;
136+ var patch = dmp . patch_fromText ( revision . patch ) ;
139137 var operations = Note . transformPatchToOperations ( patch , contentLength ) ;
140- var authorship = note . authorship ? JSON . parse ( LZString . decompressFromBase64 ( note . authorship ) ) : [ ] ;
138+ var authorship = note . authorship ;
141139 for ( var i = 0 ; i < operations . length ; i ++ ) {
142140 authorship = Note . updateAuthorshipByOperation ( operations [ i ] , null , authorship ) ;
143141 }
144142 note . update ( {
145- authorship : LZString . compressToBase64 ( JSON . stringify ( authorship ) )
143+ authorship : JSON . stringify ( authorship )
146144 } ) . then ( function ( note ) {
147145 return callback ( null , note . id ) ;
148146 } ) . catch ( function ( err ) {
@@ -264,10 +262,7 @@ module.exports = function (sequelize, DataTypes) {
264262 return markdown . substr ( 0 , 100 ) . replace ( / (?: \r \n | \r | \n ) / g, ' ' ) ;
265263 } ,
266264 decodeTitle : function ( title ) {
267- var decodedTitle = LZString . decompressFromBase64 ( title ) ;
268- if ( decodedTitle ) title = decodedTitle ;
269- else title = 'Untitled' ;
270- return title ;
265+ return title ? title : 'Untitled' ;
271266 } ,
272267 generateWebTitle : function ( title ) {
273268 title = ! title || title == "Untitled" ? "HackMD - Collaborative markdown notes" : title + " - HackMD" ;
@@ -496,8 +491,8 @@ module.exports = function (sequelize, DataTypes) {
496491 if ( Note . checkFileExist ( filePath ) ) {
497492 var fsCreatedTime = moment ( fs . statSync ( filePath ) . ctime ) ;
498493 body = fs . readFileSync ( filePath , 'utf8' ) ;
499- note . title = LZString . compressToBase64 ( Note . parseNoteTitle ( body ) ) ;
500- note . content = LZString . compressToBase64 ( body ) ;
494+ note . title = Note . parseNoteTitle ( body ) ;
495+ note . content = body ;
501496 if ( filePath !== config . defaultnotepath ) {
502497 note . createdAt = fsCreatedTime ;
503498 }
0 commit comments