New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.10 - Image PASTE not working - from filesystem #3481

Open
mlipok opened this Issue Nov 8, 2016 · 56 comments

Comments

Projects
None yet
@mlipok

mlipok commented Nov 8, 2016

I took a screenshot from an app and I wanted to paste the screenshot to the ticket.
There is a small "progress bar" rather than a spinning wheel - which means data is being uploaded....
but the image does not appear on the edited ticket's content :(

@ntozier

This comment has been minimized.

Show comment
Hide comment
@ntozier

ntozier Nov 8, 2016

Contributor

This is a redactor feature and should be addressed upstream with them (@JediKev @protich). In the meanwhile if you simply click the insert image icon and drag and drop the image you should have better luck.

Contributor

ntozier commented Nov 8, 2016

This is a redactor feature and should be addressed upstream with them (@JediKev @protich). In the meanwhile if you simply click the insert image icon and drag and drop the image you should have better luck.

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Nov 8, 2016

Thanks for answer
I will try your solution soon.

mlipok commented Nov 8, 2016

Thanks for answer
I will try your solution soon.

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Nov 21, 2016

Of course it works but I hope this will be fixed soon, as COPY PASTE images was one of the best feature in this HTML Editor.

mlipok commented Nov 21, 2016

Of course it works but I hope this will be fixed soon, as COPY PASTE images was one of the best feature in this HTML Editor.

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Nov 21, 2016

I notice that I get this kind of error:


[INSERT INTO `ost_attachment` SET `file_id` = 6093, `type` = 'D', `object_id` = 15488, `name` = 'screenshot-NG9O']

Duplicate entry '15488-6093-D' for key 'file-type'<br />
<br />
---- Wsteczne śledzenie ----<br />
#0 (główny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (główny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (główny katalog)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (główny katalog)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (główny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (główny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 [internal function]: DraftAjaxAPI->uploadInlineImage('15488')<br />
#7 (główny katalog)/include/class.dispatcher.php(145): call_user_func_array(Array, Array)<br />
#8 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('15488/attach', Array)<br />
#9 (główny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('15488/attach', Array)<br />
#10 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/15488/at...', NULL)<br />
#11 (główny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/15488/at...')<br />
#12 {main}


But now this PASTE Image appears in editor.

mlipok commented Nov 21, 2016

I notice that I get this kind of error:


[INSERT INTO `ost_attachment` SET `file_id` = 6093, `type` = 'D', `object_id` = 15488, `name` = 'screenshot-NG9O']

Duplicate entry '15488-6093-D' for key 'file-type'<br />
<br />
---- Wsteczne śledzenie ----<br />
#0 (główny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (główny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (główny katalog)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (główny katalog)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (główny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (główny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 [internal function]: DraftAjaxAPI->uploadInlineImage('15488')<br />
#7 (główny katalog)/include/class.dispatcher.php(145): call_user_func_array(Array, Array)<br />
#8 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('15488/attach', Array)<br />
#9 (główny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('15488/attach', Array)<br />
#10 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/15488/at...', NULL)<br />
#11 (główny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/15488/at...')<br />
#12 {main}


But now this PASTE Image appears in editor.

@vieckzand

This comment has been minimized.

Show comment
Hide comment
@vieckzand

vieckzand Dec 7, 2016

I have the same error when copy paste image from clipboard (DB Error #1062). Can anyone solve for this?
Thank you

vieckzand commented Dec 7, 2016

I have the same error when copy paste image from clipboard (DB Error #1062). Can anyone solve for this?
Thank you

@sjaakverhoog

This comment has been minimized.

Show comment
Hide comment
@sjaakverhoog

sjaakverhoog Dec 8, 2016

Me to:
DB Error #1062 [INSERT INTOost_attachmentSETfile_id= 112,type= 'D',object_id= 184,name` = 'screenshot-FfHO'] Duplicate entry '184-112-D' for key 'file-type'

---- Backtrace ----
#0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO o...') #1 (root)/include/class.orm.php(3133): db_query('INSERT INTOos...', true, true)
#2 (root)/include/class.orm.php(597): MySqlExecutor->execute()
#3 (root)/include/class.attachment.php(161): VerySimpleModel->save()
#4 (root)/include/ajax.draft.php(101): GenericAttachments->upload(Array)
#5 (root)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))
#6 (root)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImage('184')
#7 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('184/attach', Array)
#8 (root)/include/class.dispatcher.php(120): Dispatcher->resolve('184/attach', Array)
#9 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/184/atta...', NULL)
#10 (root)/scp/ajax.php(262): Dispatcher->resolve('/draft/184/atta...')
#11 {main}`

sjaakverhoog commented Dec 8, 2016

Me to:
DB Error #1062 [INSERT INTOost_attachmentSETfile_id= 112,type= 'D',object_id= 184,name` = 'screenshot-FfHO'] Duplicate entry '184-112-D' for key 'file-type'

---- Backtrace ----
#0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO o...') #1 (root)/include/class.orm.php(3133): db_query('INSERT INTOos...', true, true)
#2 (root)/include/class.orm.php(597): MySqlExecutor->execute()
#3 (root)/include/class.attachment.php(161): VerySimpleModel->save()
#4 (root)/include/ajax.draft.php(101): GenericAttachments->upload(Array)
#5 (root)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))
#6 (root)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImage('184')
#7 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('184/attach', Array)
#8 (root)/include/class.dispatcher.php(120): Dispatcher->resolve('184/attach', Array)
#9 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/184/atta...', NULL)
#10 (root)/scp/ajax.php(262): Dispatcher->resolve('/draft/184/atta...')
#11 {main}`

@JediKev

This comment has been minimized.

Show comment
Hide comment
@JediKev

JediKev Dec 8, 2016

Member

Could you please describe your environment and osTicket version as I can not reproduce this issue.

Member

JediKev commented Dec 8, 2016

Could you please describe your environment and osTicket version as I can not reproduce this issue.

@sjaakverhoog

This comment has been minimized.

Show comment
Hide comment
@sjaakverhoog

sjaakverhoog commented Dec 8, 2016

screenshot_2016-12-08-18-20-39

@JediKev

This comment has been minimized.

Show comment
Hide comment
@JediKev

JediKev Dec 8, 2016

Member

Are you trying to copy and paste on that tablet/phone or on a computer?

Member

JediKev commented Dec 8, 2016

Are you trying to copy and paste on that tablet/phone or on a computer?

@sjaakverhoog

This comment has been minimized.

Show comment
Hide comment
@sjaakverhoog

sjaakverhoog Dec 8, 2016

No on a PC.. But i wasn't close tot my PC when your asked for more info. I want tot paste a received email from outlook with images inside the text. When i paste everything i see dubble "enter" lines and no images.

sjaakverhoog commented Dec 8, 2016

No on a PC.. But i wasn't close tot my PC when your asked for more info. I want tot paste a received email from outlook with images inside the text. When i paste everything i see dubble "enter" lines and no images.

@JediKev

This comment has been minimized.

Show comment
Hide comment
@JediKev

JediKev Dec 8, 2016

Member

Ok, firstly I'm running CentOS 7 with Apache and osTicket v1.10(latest) and I'm able to paste images all day long with no errors. You need to explain your environment in more detail so we can further try to replicate that issue.
Secondly, we do not support pasting from a Word Document and keeping its format and attachments.

Member

JediKev commented Dec 8, 2016

Ok, firstly I'm running CentOS 7 with Apache and osTicket v1.10(latest) and I'm able to paste images all day long with no errors. You need to explain your environment in more detail so we can further try to replicate that issue.
Secondly, we do not support pasting from a Word Document and keeping its format and attachments.

@ntozier

This comment has been minimized.

Show comment
Hide comment
Contributor

ntozier commented Dec 9, 2016

@thinkfuture

This comment has been minimized.

Show comment
Hide comment
@thinkfuture

thinkfuture Jan 31, 2017

Is there an update on this issue? Find it hard to believe that such a key element is lacking in the editor for a support application. Please advise.

thinkfuture commented Jan 31, 2017

Is there an update on this issue? Find it hard to believe that such a key element is lacking in the editor for a support application. Please advise.

@rayfoss rayfoss changed the title from v1.10 - Image PASTE not working to v1.10 - Image PASTE not working - from filesystem Feb 8, 2017

@jane-t

This comment has been minimized.

Show comment
Hide comment
@jane-t

jane-t Mar 30, 2017

I am also getting this error. I am trying to paste images from the clipboard (screen grabs) they do not exist as files on my Windows PC, I just grab them with a screen grabber, copy the image to the clipboard and try and paste into the Editor (this worked fine with 1.8 which we were running previously to updating to 1.10)

jane-t commented Mar 30, 2017

I am also getting this error. I am trying to paste images from the clipboard (screen grabs) they do not exist as files on my Windows PC, I just grab them with a screen grabber, copy the image to the clipboard and try and paste into the Editor (this worked fine with 1.8 which we were running previously to updating to 1.10)

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Apr 7, 2017

Try to paste them several times.
This should works sometimes, at least it works in this way for my case.
Could you confirm that this works in this way ?

mlipok commented Apr 7, 2017

Try to paste them several times.
This should works sometimes, at least it works in this way for my case.
Could you confirm that this works in this way ?

@jane-t

This comment has been minimized.

Show comment
Hide comment
@jane-t

jane-t Apr 9, 2017

Thanks pasting twice does work.

jane-t commented Apr 9, 2017

Thanks pasting twice does work.

@2ge

This comment has been minimized.

Show comment
Hide comment
@2ge

2ge May 5, 2017

I got same problem with v1.10-47-gb9f0937 (b9f0937), is there some fix ? - I have English pack installed only (default)

[INSERT INTO `ost_attachment` SET `file_id` = 331, `type` = 'D', `object_id` = 142, `name` = 'screenshot-lgbA']

Duplicate entry '142-331-D' for key 'file-type'<br />
<br />
---- Backtrace ----<br />
#0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (root)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (root)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (root)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (root)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (root)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 [internal function]: DraftAjaxAPI->uploadInlineImage('142')<br />
#7 (root)/include/class.dispatcher.php(145): call_user_func_array(Array, Array)<br />
#8 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('142/attach', Array)<br />
#9 (root)/include/class.dispatcher.php(120): Dispatcher->resolve('142/attach', Array)<br />
#10 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/142/atta...', NULL)<br />
#11 (root)/scp/ajax.php(262): Dispatcher->resolve('/draft/142/atta...')<br />
#12 {main}

2ge commented May 5, 2017

I got same problem with v1.10-47-gb9f0937 (b9f0937), is there some fix ? - I have English pack installed only (default)

[INSERT INTO `ost_attachment` SET `file_id` = 331, `type` = 'D', `object_id` = 142, `name` = 'screenshot-lgbA']

Duplicate entry '142-331-D' for key 'file-type'<br />
<br />
---- Backtrace ----<br />
#0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (root)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (root)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (root)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (root)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (root)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 [internal function]: DraftAjaxAPI->uploadInlineImage('142')<br />
#7 (root)/include/class.dispatcher.php(145): call_user_func_array(Array, Array)<br />
#8 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('142/attach', Array)<br />
#9 (root)/include/class.dispatcher.php(120): Dispatcher->resolve('142/attach', Array)<br />
#10 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/142/atta...', NULL)<br />
#11 (root)/scp/ajax.php(262): Dispatcher->resolve('/draft/142/atta...')<br />
#12 {main}
@kest874

This comment has been minimized.

Show comment
Hide comment
@kest874

kest874 May 5, 2017

Contributor

Have noticed, if you past first then add your text it works every time.

Contributor

kest874 commented May 5, 2017

Have noticed, if you past first then add your text it works every time.

@pespi123

This comment has been minimized.

Show comment
Hide comment
@pespi123

pespi123 May 11, 2017

It also works, if you past on the same line as the text you previously wrote. The editor automatically adds a break before the image (tested in Chrome and Firefox).

This doesn't work, if you already tried to spam the image into the editor before...

pespi123 commented May 11, 2017

It also works, if you past on the same line as the text you previously wrote. The editor automatically adds a break before the image (tested in Chrome and Firefox).

This doesn't work, if you already tried to spam the image into the editor before...

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok May 11, 2017

Big thanks this is just:
Eureka !!

mlipok commented May 11, 2017

Big thanks this is just:
Eureka !!

@balojs

This comment has been minimized.

Show comment
Hide comment
@balojs

balojs May 11, 2017

Same problem

balojs commented May 11, 2017

Same problem

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok May 11, 2017

@balojs could you also confirm that @pespi123 solution works for you ?

mlipok commented May 11, 2017

@balojs could you also confirm that @pespi123 solution works for you ?

@eptiliom

This comment has been minimized.

Show comment
Hide comment
@eptiliom

eptiliom May 17, 2017

@mlipok The above solution does not work for me.

I get the following error message as soon as I try to paste.

image

EDIT:
This particular error was caused by inadequate permissions on the php upload_tmp_dir. I changed it to C:\temp in php.ini and then gave my apppool permissions to read and write to it. Now I am getting the same error as above.

eptiliom commented May 17, 2017

@mlipok The above solution does not work for me.

I get the following error message as soon as I try to paste.

image

EDIT:
This particular error was caused by inadequate permissions on the php upload_tmp_dir. I changed it to C:\temp in php.ini and then gave my apppool permissions to read and write to it. Now I am getting the same error as above.

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Aug 23, 2017

On first glance:
Yes it fix the issue - but no entirly.
I mean this is very useful fix which make it more user friendly as this starts to work.
But after quick testing there are situation when I still get errors like this:

[INSERT INTO ost_attachment SET file_id = 8493, type = 'D', object_id = 90]
Duplicate entry '90-8493-D' for key 'file-type'

---- Wsteczne sledzenie ----
#0 (glówny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')

#1 (glówny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)
#2 (glówny katalog)/include/class.orm.php(597): MySqlExecutor->execute()
#3 (glówny katalog)/include/class.attachment.php(161): VerySimpleModel->save()
#4 (glówny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)
#5 (glówny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))
#6 [internal function]: DraftAjaxAPI->uploadInlineImage('90')
#7 (glówny katalog)/include/class.dispatcher.php(145): call_user_func_array(Array, Array)
#8 (glówny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('90/attach', Array)
#9 (glówny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('90/attach', Array)
#10 (glówny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/90/attac...', NULL)
#11 (glówny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/90/attac...')
#12 {main}

But I can confirm that this qucik fix help me a lot and is very helpfull.
Thanks @dbummy

mlipok commented Aug 23, 2017

On first glance:
Yes it fix the issue - but no entirly.
I mean this is very useful fix which make it more user friendly as this starts to work.
But after quick testing there are situation when I still get errors like this:

[INSERT INTO ost_attachment SET file_id = 8493, type = 'D', object_id = 90]
Duplicate entry '90-8493-D' for key 'file-type'

---- Wsteczne sledzenie ----
#0 (glówny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')

#1 (glówny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)
#2 (glówny katalog)/include/class.orm.php(597): MySqlExecutor->execute()
#3 (glówny katalog)/include/class.attachment.php(161): VerySimpleModel->save()
#4 (glówny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)
#5 (glówny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))
#6 [internal function]: DraftAjaxAPI->uploadInlineImage('90')
#7 (glówny katalog)/include/class.dispatcher.php(145): call_user_func_array(Array, Array)
#8 (glówny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('90/attach', Array)
#9 (glówny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('90/attach', Array)
#10 (glówny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/90/attac...', NULL)
#11 (glówny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/90/attac...')
#12 {main}

But I can confirm that this qucik fix help me a lot and is very helpfull.
Thanks @dbummy

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Aug 23, 2017

@pespi123 said:

This doesn't work, if you already tried to spam the image into the editor before...

I can confirm that in @dbummy fix , the problem with multiple insterting the same Image is also fixed but, only if you paste it quickly multiple times.

mlipok commented Aug 23, 2017

@pespi123 said:

This doesn't work, if you already tried to spam the image into the editor before...

I can confirm that in @dbummy fix , the problem with multiple insterting the same Image is also fixed but, only if you paste it quickly multiple times.

@dbummy

This comment has been minimized.

Show comment
Hide comment
@dbummy

dbummy Aug 23, 2017

So it seems as if the reason this happens is something that is not new knowledge. The comment just above where I made that change is:
(Line 964 in redactor-plugins.js)
// Capture the selection position every so often as Redactor seems to
// drop it when attempting an image paste before paste browser event
// fires

and it seems like it is just giving the cursor a vertical offset. When I applied the change, most of my work computers have been ok but when I checked it with my MacBook Pro, it had the same results as before (I'm guessing that it being a pixel offset and the Macbook having a much higher resolution, it didn't "land" where it was supposed to. I got some of the Database errors as well but they seem to have slowed down since this morning. I got about 5-8 first thing this morning and then I only got one more around 11ish (Central). I will continue to monitor and try other things to see if I can come up with a more elegant solution.

dbummy commented Aug 23, 2017

So it seems as if the reason this happens is something that is not new knowledge. The comment just above where I made that change is:
(Line 964 in redactor-plugins.js)
// Capture the selection position every so often as Redactor seems to
// drop it when attempting an image paste before paste browser event
// fires

and it seems like it is just giving the cursor a vertical offset. When I applied the change, most of my work computers have been ok but when I checked it with my MacBook Pro, it had the same results as before (I'm guessing that it being a pixel offset and the Macbook having a much higher resolution, it didn't "land" where it was supposed to. I got some of the Database errors as well but they seem to have slowed down since this morning. I got about 5-8 first thing this morning and then I only got one more around 11ish (Central). I will continue to monitor and try other things to see if I can come up with a more elegant solution.

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Aug 23, 2017

Thanks for your involvment @dbummy .

mlipok commented Aug 23, 2017

Thanks for your involvment @dbummy .

@dbummy

This comment has been minimized.

Show comment
Hide comment
@dbummy

dbummy Aug 23, 2017

No problem. Glad I can help!

dbummy commented Aug 23, 2017

No problem. Glad I can help!

@dbummy

This comment has been minimized.

Show comment
Hide comment
@dbummy

dbummy Aug 23, 2017

I'm using MariaDB (I've mushed osTicket with Snipe-IT to handle asset management) so I don't know if that has any influence on the error 1062 or not. I did add

'OLD_MODE' => 'NO_DUP_KEY_WARNINGS_WITH_IGNORE'

to /include/mysqli.php (around line 77) as described here: #3193

and I have not gotten any more 1062 errors (as of yet) and I have been paste happy all over testing. Seems like this has suppressed the error on my system but like I said, I am using MariaDB.

image

dbummy commented Aug 23, 2017

I'm using MariaDB (I've mushed osTicket with Snipe-IT to handle asset management) so I don't know if that has any influence on the error 1062 or not. I did add

'OLD_MODE' => 'NO_DUP_KEY_WARNINGS_WITH_IGNORE'

to /include/mysqli.php (around line 77) as described here: #3193

and I have not gotten any more 1062 errors (as of yet) and I have been paste happy all over testing. Seems like this has suppressed the error on my system but like I said, I am using MariaDB.

image

@fredricj

This comment has been minimized.

Show comment
Hide comment
@fredricj

fredricj Aug 24, 2017

As I read the mariaDB manual NO_DUP_KEY_WARNINGS_WITH_IGNORE shouldn't help since it's not an INSERT IGNORE which causes the 1062 error

fredricj commented Aug 24, 2017

As I read the mariaDB manual NO_DUP_KEY_WARNINGS_WITH_IGNORE shouldn't help since it's not an INSERT IGNORE which causes the 1062 error

@dbummy

This comment has been minimized.

Show comment
Hide comment
@dbummy

dbummy Aug 24, 2017

Interesting. I will continue to test. I still have not received any more with the change whereas yesterday by now I already had ~5-8 by this time. I will continue to test and see if I can further pick apart the redactor-plugins.js file (this is where I believe that the errors and weird issues are coming from) Thanks @fredricj !

dbummy commented Aug 24, 2017

Interesting. I will continue to test. I still have not received any more with the change whereas yesterday by now I already had ~5-8 by this time. I will continue to test and see if I can further pick apart the redactor-plugins.js file (this is where I believe that the errors and weird issues are coming from) Thanks @fredricj !

@dbummy

This comment has been minimized.

Show comment
Hide comment
@dbummy

dbummy Aug 24, 2017

Ok, I was going off of my emails and not off the logs for the 1062 errors and they are still showing up (guess my email got tired of sending them). I think that the pasting issue stems from Redactor trying to pick up where it left off after pasting the image. I have tried at a few different installations of 1.10 running on different OSs hitting "Enter" 10 times and then try to paste it messes up every time. Can someone verify that this is not true for all instances?
If anyone has any type of JS skills can you please look at redactor-plugins.js Lines 948 - 1072 and see if you can figure out what is going on before/after/during pasting an image from clipboard? Thanks!

dbummy commented Aug 24, 2017

Ok, I was going off of my emails and not off the logs for the 1062 errors and they are still showing up (guess my email got tired of sending them). I think that the pasting issue stems from Redactor trying to pick up where it left off after pasting the image. I have tried at a few different installations of 1.10 running on different OSs hitting "Enter" 10 times and then try to paste it messes up every time. Can someone verify that this is not true for all instances?
If anyone has any type of JS skills can you please look at redactor-plugins.js Lines 948 - 1072 and see if you can figure out what is going on before/after/during pasting an image from clipboard? Thanks!

@vieckzand

This comment has been minimized.

Show comment
Hide comment
@vieckzand

vieckzand Aug 25, 2017

I think the problem is when paste image after hit "Enter", if i type some character and paste image from clipboard without "Enter" i'm not get error DB Error #1062

vieckzand commented Aug 25, 2017

I think the problem is when paste image after hit "Enter", if i type some character and paste image from clipboard without "Enter" i'm not get error DB Error #1062

@mmcgrath

This comment has been minimized.

Show comment
Hide comment
@mmcgrath

mmcgrath Nov 7, 2017

I'm getting this too: fresh install (this morning!)
screen shot 2017-11-07 at 4 55 48 pm

DB Error #1062
[INSERT INTO `ost_attachment` SET `file_id` = 14, `type` = 'D', `object_id` = 7] Duplicate entry '7-14-D' for key 'file-type'

 ---- Backtrace ----
 #0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')
 #1 (root)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)
 #2 (root)/include/class.orm.php(597): MySqlExecutor->execute()
 #3 (root)/include/class.attachment.php(161): VerySimpleModel->save()
 #4 (root)/include/ajax.draft.php(101): GenericAttachments->upload(Array)
 #5 (root)/include/ajax.draft.php(229): DraftAjaxAPI->_uploadInlineImage(Object(Draft))
 #6 (root)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImageClient('7')
 #7 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('7/attach', Array)
 #8 (root)/include/class.dispatcher.php(120): Dispatcher->resolve('7/attach', Array)
 #9 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/7/attach', NULL)
 #10 (root)/ajax.php(50): Dispatcher->resolve('/draft/7/attach')
 #11 {main}


Sorry - I don't have the necessary JS skills to even understand the problem, let alone fix it....

mmcgrath commented Nov 7, 2017

I'm getting this too: fresh install (this morning!)
screen shot 2017-11-07 at 4 55 48 pm

DB Error #1062
[INSERT INTO `ost_attachment` SET `file_id` = 14, `type` = 'D', `object_id` = 7] Duplicate entry '7-14-D' for key 'file-type'

 ---- Backtrace ----
 #0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')
 #1 (root)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)
 #2 (root)/include/class.orm.php(597): MySqlExecutor->execute()
 #3 (root)/include/class.attachment.php(161): VerySimpleModel->save()
 #4 (root)/include/ajax.draft.php(101): GenericAttachments->upload(Array)
 #5 (root)/include/ajax.draft.php(229): DraftAjaxAPI->_uploadInlineImage(Object(Draft))
 #6 (root)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImageClient('7')
 #7 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('7/attach', Array)
 #8 (root)/include/class.dispatcher.php(120): Dispatcher->resolve('7/attach', Array)
 #9 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/7/attach', NULL)
 #10 (root)/ajax.php(50): Dispatcher->resolve('/draft/7/attach')
 #11 {main}


Sorry - I don't have the necessary JS skills to even understand the problem, let alone fix it....

@Aka4Code

This comment has been minimized.

Show comment
Hide comment
@Aka4Code

Aka4Code Nov 30, 2017

I can confirm this error - migrated from 1.9.8.1 to 1.10.1 and when I paste image from clipboard after I hit "Enter" then I get "DB Error #1062" - can't paste image:

[INSERT INTO `ost_attachment` SET `file_id` = 6930, `type` = 'D', `object_id` = 46194]

Duplicate entry '46194-6930-D' for key 'file-type'<br /> <br />
---- Wsteczne śledzenie ----<br />
#0 (główny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (główny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (główny katalog)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (główny katalog)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (główny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (główny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 (główny katalog)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImage('46194')<br />
#7 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('46194/attach', Array)<br />
#8 (główny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('46194/attach', Array)<br />
#9 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/46194/at...', NULL)<br />
#10 (główny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/46194/at...')<br />
#11 {main}

image

Temporary solution is to type some characters after I hit Enter, and before I paste image.

Aka4Code commented Nov 30, 2017

I can confirm this error - migrated from 1.9.8.1 to 1.10.1 and when I paste image from clipboard after I hit "Enter" then I get "DB Error #1062" - can't paste image:

[INSERT INTO `ost_attachment` SET `file_id` = 6930, `type` = 'D', `object_id` = 46194]

Duplicate entry '46194-6930-D' for key 'file-type'<br /> <br />
---- Wsteczne śledzenie ----<br />
#0 (główny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (główny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (główny katalog)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (główny katalog)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (główny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (główny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 (główny katalog)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImage('46194')<br />
#7 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('46194/attach', Array)<br />
#8 (główny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('46194/attach', Array)<br />
#9 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/46194/at...', NULL)<br />
#10 (główny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/46194/at...')<br />
#11 {main}

image

Temporary solution is to type some characters after I hit Enter, and before I paste image.

@CashDesk

This comment has been minimized.

Show comment
Hide comment
@CashDesk

CashDesk Dec 3, 2017

Is there allready a solution for this issue? I have installed the latest version but still have this problem

CashDesk commented Dec 3, 2017

Is there allready a solution for this issue? I have installed the latest version but still have this problem

@JediKev

This comment has been minimized.

Show comment
Hide comment
@JediKev

JediKev Dec 8, 2017

Member

Everyone, try this pull request and get back to me: #4113

Cheers.

Member

JediKev commented Dec 8, 2017

Everyone, try this pull request and get back to me: #4113

Cheers.

@Stoolbend

This comment has been minimized.

Show comment
Hide comment
@Stoolbend

Stoolbend Dec 11, 2017

Applied the new Redactor version from #4113 and image paste is now working on v1.10

When pasting images in one after another from Snipping Tool, it was pasting the image every other time but it was still pasting images in.

Stoolbend commented Dec 11, 2017

Applied the new Redactor version from #4113 and image paste is now working on v1.10

When pasting images in one after another from Snipping Tool, it was pasting the image every other time but it was still pasting images in.

@Aka4Code

This comment has been minimized.

Show comment
Hide comment
@Aka4Code

Aka4Code Dec 22, 2017

Installed changes from #4113 and problem with image pasting DB Error #1062 still exists:

[INSERT INTO `ost_attachment` SET `file_id` = 7073, `type` = 'D', `object_id` = 46325]

Duplicate entry '46325-7073-D' for key 'file-type'<br /> <br />
---- Wsteczne śledzenie ----<br />
#0 (główny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (główny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (główny katalog)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (główny katalog)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (główny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (główny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 (główny katalog)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImage('46325')<br />
#7 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('46325/attach', Array)<br />
#8 (główny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('46325/attach', Array)<br />
#9 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/46325/at...', NULL)<br />
#10 (główny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/46325/at...')<br />
#11 {main}

Aka4Code commented Dec 22, 2017

Installed changes from #4113 and problem with image pasting DB Error #1062 still exists:

[INSERT INTO `ost_attachment` SET `file_id` = 7073, `type` = 'D', `object_id` = 46325]

Duplicate entry '46325-7073-D' for key 'file-type'<br /> <br />
---- Wsteczne śledzenie ----<br />
#0 (główny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (główny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (główny katalog)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (główny katalog)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (główny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (główny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 (główny katalog)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImage('46325')<br />
#7 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('46325/attach', Array)<br />
#8 (główny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('46325/attach', Array)<br />
#9 (główny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/46325/at...', NULL)<br />
#10 (główny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/46325/at...')<br />
#11 {main}
@rjkunde

This comment has been minimized.

Show comment
Hide comment
@rjkunde

rjkunde Jan 11, 2018

Sorry if I'm beating a dead horse here, but I've been trying to find a solution for quite a while. My configuration is shown below. I've tried the two fixes mentioned in this thread: upgrading redactor to 10.2.5, and changing Line 964 in redactor-plugins.js. When I upgrade redactor, the DB errors stop, but paste still doesn't function. When I change line 964 in redactor-plugins.js, the first paste works, but subsequent pastes do not, followed by a string of DB errors. Database errors shown below too.

Anyone have any other suggestions? It seems like redactor has been abandoned:

image

INSERT INTOost_attachmentSETfile_id= 2257,type= 'D',object_id` = 10]

Duplicate entry '10-2257-D' for key 'file-type'


---- Backtrace ----

#0 PATH-TO-MY-OSTICKET-DIRECTORY\include\mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO o...')<br /> #1 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.orm.php(3133): db_query('INSERT INTOos...', true, true)

#2 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.orm.php(597): MySqlExecutor->execute()

#3 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.attachment.php(161): VerySimpleModel->save()

#4 PATH-TO-MY-OSTICKET-DIRECTORY\include\ajax.draft.php(101): GenericAttachments->upload(Array)

#5 PATH-TO-MY-OSTICKET-DIRECTORY\include\ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))

#6 [internal function]: DraftAjaxAPI->uploadInlineImage('10')

#7 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.dispatcher.php(145): call_user_func_array(Array, Array)

#8 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.dispatcher.php(38): UrlMatcher->dispatch('10/attach', Array)

#9 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.dispatcher.php(120): Dispatcher->resolve('10/attach', Array)

#10 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.dispatcher.php(38): UrlMatcher->dispatch('/draft/10/attac...', NULL)

#11 PATH-TO-MY-OSTICKET-DIRECTORY\scp\ajax.php(262): Dispatcher->resolve('/draft/10/attac...')

#12 {main}
`

rjkunde commented Jan 11, 2018

Sorry if I'm beating a dead horse here, but I've been trying to find a solution for quite a while. My configuration is shown below. I've tried the two fixes mentioned in this thread: upgrading redactor to 10.2.5, and changing Line 964 in redactor-plugins.js. When I upgrade redactor, the DB errors stop, but paste still doesn't function. When I change line 964 in redactor-plugins.js, the first paste works, but subsequent pastes do not, followed by a string of DB errors. Database errors shown below too.

Anyone have any other suggestions? It seems like redactor has been abandoned:

image

INSERT INTOost_attachmentSETfile_id= 2257,type= 'D',object_id` = 10]

Duplicate entry '10-2257-D' for key 'file-type'


---- Backtrace ----

#0 PATH-TO-MY-OSTICKET-DIRECTORY\include\mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO o...')<br /> #1 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.orm.php(3133): db_query('INSERT INTOos...', true, true)

#2 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.orm.php(597): MySqlExecutor->execute()

#3 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.attachment.php(161): VerySimpleModel->save()

#4 PATH-TO-MY-OSTICKET-DIRECTORY\include\ajax.draft.php(101): GenericAttachments->upload(Array)

#5 PATH-TO-MY-OSTICKET-DIRECTORY\include\ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))

#6 [internal function]: DraftAjaxAPI->uploadInlineImage('10')

#7 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.dispatcher.php(145): call_user_func_array(Array, Array)

#8 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.dispatcher.php(38): UrlMatcher->dispatch('10/attach', Array)

#9 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.dispatcher.php(120): Dispatcher->resolve('10/attach', Array)

#10 PATH-TO-MY-OSTICKET-DIRECTORY\include\class.dispatcher.php(38): UrlMatcher->dispatch('/draft/10/attac...', NULL)

#11 PATH-TO-MY-OSTICKET-DIRECTORY\scp\ajax.php(262): Dispatcher->resolve('/draft/10/attac...')

#12 {main}
`

@Aka4Code

This comment has been minimized.

Show comment
Hide comment
@Aka4Code

Aka4Code commented Jan 12, 2018

@JediKev Are you considering switching to another WYSIWYG editor? (https://summernote.org /
https://quilljs.com / https://www.tinymce.com/ / https://ckeditor.com )

@vieckzand

This comment has been minimized.

Show comment
Hide comment
@vieckzand

vieckzand Jan 15, 2018

@Aka4Code if you want use tinymce, you can read this article http://osticket.com/forum/discussion/91133/plugin-tinymce.
Now, i use that and so far solve copy paste image problem

vieckzand commented Jan 15, 2018

@Aka4Code if you want use tinymce, you can read this article http://osticket.com/forum/discussion/91133/plugin-tinymce.
Now, i use that and so far solve copy paste image problem

@Aka4Code

This comment has been minimized.

Show comment
Hide comment
@Aka4Code

Aka4Code Jan 23, 2018

@JediKev so why you don't wont to replace Redactor with TinyMCE? Someone already made plugin and as @vieckzand said it's working with osTicket....

Aka4Code commented Jan 23, 2018

@JediKev so why you don't wont to replace Redactor with TinyMCE? Someone already made plugin and as @vieckzand said it's working with osTicket....

@vieckzand

This comment has been minimized.

Show comment
Hide comment
@vieckzand

vieckzand Jan 23, 2018

@Aka4Code I think the problem is size data in database when use TinyMCE as text editor to save image in text (image result from copy paste image). You can test what is different TinyMCE and Redactor.
I already test for the same text with same image if i use redactor i get small size rather than TinyMCE.
Thanks

vieckzand commented Jan 23, 2018

@Aka4Code I think the problem is size data in database when use TinyMCE as text editor to save image in text (image result from copy paste image). You can test what is different TinyMCE and Redactor.
I already test for the same text with same image if i use redactor i get small size rather than TinyMCE.
Thanks

@JediKev

This comment has been minimized.

Show comment
Hide comment
@JediKev

JediKev Jan 23, 2018

Member

@Aka4Code because we have totally different plans ahead for the text editor. I can't reveal these plans just yet but know changes are coming soon for the text editor. Cheers.

Member

JediKev commented Jan 23, 2018

@Aka4Code because we have totally different plans ahead for the text editor. I can't reveal these plans just yet but know changes are coming soon for the text editor. Cheers.

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Jan 24, 2018

I hope this editor will stay.
Or at least new new version will have editor with the same feature - "easy" image/screenshot paste .
On each forum/helpdes which I know the main problem is that I must ATTACH image and can not just PASTE them, and this is non efective way to work with computers "messaging/communication" systems.

Remaining in hope and expectation,
mLipok

mlipok commented Jan 24, 2018

I hope this editor will stay.
Or at least new new version will have editor with the same feature - "easy" image/screenshot paste .
On each forum/helpdes which I know the main problem is that I must ATTACH image and can not just PASTE them, and this is non efective way to work with computers "messaging/communication" systems.

Remaining in hope and expectation,
mLipok

@JediKev

This comment has been minimized.

Show comment
Hide comment
@JediKev

JediKev Jan 24, 2018

Member

@mlipok

Trust me, attaching/pasting images will stay as easy as it is. The editor will just be way better, possibly have more features, and will hopefully fix all the pasting issues seen recently. I'm glad most everyone is staying hopeful as we are putting a lot of work into the next few releases.

Cheers.

Member

JediKev commented Jan 24, 2018

@mlipok

Trust me, attaching/pasting images will stay as easy as it is. The editor will just be way better, possibly have more features, and will hopefully fix all the pasting issues seen recently. I'm glad most everyone is staying hopeful as we are putting a lot of work into the next few releases.

Cheers.

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Jan 24, 2018

Thanks for your answer.

mlipok commented Jan 24, 2018

Thanks for your answer.

@davidegiunchidiennea

This comment has been minimized.

Show comment
Hide comment
@davidegiunchidiennea

davidegiunchidiennea Feb 20, 2018

@JediKev your patch #4113 does fix the problem, thank you

davidegiunchidiennea commented Feb 20, 2018

@JediKev your patch #4113 does fix the problem, thank you

@mlipok

This comment has been minimized.

Show comment
Hide comment
@mlipok

mlipok Feb 21, 2018

@davidegiunchidiennea as you can read from last @JediKev response the DevTeam has taken a decision to change editor at all (as far as I understand @JediKev statement).
So be patient in waiting for new version.

mlipok commented Feb 21, 2018

@davidegiunchidiennea as you can read from last @JediKev response the DevTeam has taken a decision to change editor at all (as far as I understand @JediKev statement).
So be patient in waiting for new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment