{"action":"opened","issue":{"url":"https://api.github.com/repos/twostairs/paperwork/issues/357","labels_url":"https://api.github.com/repos/twostairs/paperwork/issues/357/labels{/name}","comments_url":"https://api.github.com/repos/twostairs/paperwork/issues/357/comments","events_url":"https://api.github.com/repos/twostairs/paperwork/issues/357/events","html_url":"https://github.com/twostairs/paperwork/issues/357","id":71338725,"number":357,"title":"Saving note with code snippet - error","user":{"login":"doc-jay","id":11081155,"avatar_url":"https://avatars.githubusercontent.com/u/11081155?v=3","gravatar_id":"","url":"https://api.github.com/users/doc-jay","html_url":"https://github.com/doc-jay","followers_url":"https://api.github.com/users/doc-jay/followers","following_url":"https://api.github.com/users/doc-jay/following{/other_user}","gists_url":"https://api.github.com/users/doc-jay/gists{/gist_id}","starred_url":"https://api.github.com/users/doc-jay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doc-jay/subscriptions","organizations_url":"https://api.github.com/users/doc-jay/orgs","repos_url":"https://api.github.com/users/doc-jay/repos","events_url":"https://api.github.com/users/doc-jay/events{/privacy}","received_events_url":"https://api.github.com/users/doc-jay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-27T16:38:52Z","updated_at":"2015-04-27T16:38:52Z","closed_at":null,"body":"Running the latest git code from paperwork\r\n\r\nI am trying to save a note with a code snippet that is a MYSQL query.  It acts as it saves it, but after you go back to your note, it doesn't have any snippet at all.  I can enter plain text in it just fine.\r\n\r\nWhen I do the code snippet, I choose 'SQL' but it doesn't matter which one I choose, they all act the same way.\r\n\r\nHere is the laravel.log:\r\n\r\n```\r\nNext exception 'Illuminate\\Database\\QueryException' with message 'SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'content_preview' at row 1 (SQL: insert into `versions` (`title`, `content`, `content_preview`, `updated_at`, `created_at`) values (test note, <pre><code class=\"language-sql\">select distinct(t2_f_instance.sop_cuid), count(*) as count\r\nfrom files t0_f, filesystem t1_f_fileSystem, instance t2_f_instance\r\nWHERE t0_f.file_status = 0 \r\nAND t0_f.file_tsuid = '1.2.840.10008.1.2' \r\nAND t1_f_fileSystem.pk\r\nin ('1', '2', '3')\r\nAND t0_f.filesystem_fk=t1_f_fileSystem.pk\r\nAND t0_f.instance_fk=t2_f_instance.pk\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.11.1'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.11'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.22'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.33'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.50'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.59'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.67'\r\nAND t0_f.created_time &lt; now() - INTERVAL 1 day\r\ngroup by t2_f_instance.sop_cuid</code></pre><p>new test</p>, select distinct(t2_f_instance.sop_cuid), count(*) as count\r\nfrom files t0_f, filesystem t1_f_fileSystem, instance t2_f_instance\r\nWHERE t0_f.file_status = 0 \r\nAND t0_f.file_tsuid = '1.2.840.10008.1.2' \r\nAND t1_f_fileSystem.pk\r\nin ('1', '2', '3')\r\nAND t0_f.filesystem_fk=t1_f_fileSystem.pk\r\nAND t0_f.instance_fk=t2_f_instance.pk\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.11.1'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.11'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.22'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.33'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.50'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.59'\r\nand t2_f_instance.sop_cuid != '1.2.840.10008.5.1.4.1.1.88.67'\r\nAND t0_f.created_time &lt; now() - INTERVAL 1 day\r\ngroup by t2_f_instance.sop_cuidnew test, 2015-04-27 16:27:52, 2015-04-27 16:27:52))' in /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Connection.php:625\r\nStack trace:\r\n#0 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Connection.php(581): Illuminate\\Database\\Connection->runQueryCallback('insert into `ve...', Array, Object(Closure))\r\n#1 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Connection.php(370): Illuminate\\Database\\Connection->run('insert into `ve...', Array, Object(Closure))\r\n#2 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Connection.php(327): Illuminate\\Database\\Connection->statement('insert into `ve...', Array)\r\n#3 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(30): Illuminate\\Database\\Connection->insert('insert into `ve...', Array)\r\n#4 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1910): Illuminate\\Database\\Query\\Processors\\Processor->processInsertGetId(Object(Illuminate\\Database\\Query\\Builder), 'insert into `ve...', Array, 'id')\r\n#5 [internal function]: Illuminate\\Database\\Query\\Builder->insertGetId(Array, 'id')\r\n#6 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(972): call_user_func_array(Array, Array)\r\n#7 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1580): Illuminate\\Database\\Eloquent\\Builder->__call('insertGetId', Array)\r\n#8 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1580): Illuminate\\Database\\Eloquent\\Builder->insertGetId(Array, 'id')\r\n#9 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1550): Illuminate\\Database\\Eloquent\\Model->insertAndSetId(Object(Illuminate\\Database\\Eloquent\\Builder), Array)\r\n#10 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1456): Illuminate\\Database\\Eloquent\\Model->performInsert(Object(Illuminate\\Database\\Eloquent\\Builder), Array)\r\n#11 /var/www/html/paperwork/frontend/app/controllers/api/v1/ApiNotesController.php(265): Illuminate\\Database\\Eloquent\\Model->save()\r\n#12 [internal function]: ApiNotesController->update('0', '22')\r\n#13 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)\r\n#14 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\\Routing\\Controller->callAction('update', Array)\r\n#15 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\\Routing\\ControllerDispatcher->call(Object(ApiNotesController), Object(Illuminate\\Routing\\Route), 'update')\r\n#16 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Routing/Router.php(967): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request), 'ApiNotesControl...', 'update')\r\n#17 [internal function]: Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}('0', '22')\r\n#18 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)\r\n#19 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1033): Illuminate\\Routing\\Route->run(Object(Illuminate\\Http\\Request))\r\n#20 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1001): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))\r\n#21 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))\r\n#22 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\\Foundation\\Application->dispatch(Object(Illuminate\\Http\\Request))\r\n#23 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\\Foundation\\Application->handle(Object(Illuminate\\Http\\Request), 1, true)\r\n#24 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\\Session\\Middleware->handle(Object(Illuminate\\Http\\Request), 1, true)\r\n#25 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\\Cookie\\Queue->handle(Object(Illuminate\\Http\\Request), 1, true)\r\n#26 /var/www/html/paperwork/frontend/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\\Cookie\\Guard->handle(Object(Illuminate\\Http\\Request), 1, true)\r\n#27 /var/www/html/paperwork/frontend/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\\StackedHttpKernel->handle(Object(Illuminate\\Http\\Request))\r\n#28 /var/www/html/paperwork/frontend/public/index.php(49): Illuminate\\Foundation\\Application->run()\r\n#29 {main}\r\n```"}}