Opened 10 years ago
Closed 10 years ago
#13080 closed Bug (fixed)
Ugly notification when response has HTML content
Reported by: | Maciej | Owned by: | Tade0 |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.5.0 |
Component: | General | Version: | 4.5.0 Beta |
Keywords: | Cc: |
Description (last modified by )
Error occurs when response from imageUploadUrl
link returns HTML content, ie PHP server returns stack trace.
Steps to reproduce:
- Configure server to return stack trace for url set in
imageUploadUrl
- Use drag and drop to upload image
- Observe ugly notification that overlaps page & editor
Attachments (1)
Change History (14)
Changed 10 years ago by
Attachment: | ugly_notification.png added |
---|
comment:1 Changed 10 years ago by
Milestone: | → CKEditor 4.5.0 |
---|
comment:2 Changed 10 years ago by
Status: | new → confirmed |
---|
comment:3 Changed 10 years ago by
Owner: | set to Tade0 |
---|---|
Status: | confirmed → assigned |
comment:4 Changed 10 years ago by
Description: | modified (diff) |
---|---|
Status: | assigned → review |
comment:5 Changed 10 years ago by
Description: | modified (diff) |
---|---|
Status: | review → assigned |
comment:6 Changed 10 years ago by
Status: | assigned → review |
---|
comment:7 Changed 10 years ago by
Status: | review → review_failed |
---|
You can not do data.message = responseError.replace( ': %1', '.' );
because you do not know what the responseError
string will be in each language.
And about checking the `content-type` it is over-complication in my opinion. The whole code is in the fileUploadResponse
listener so if someone want to have better error messages he can create his own fileUploadResponse
listener. The default listener should be as simple as possible so developers we be able to create their own listeners based on this code.
comment:9 Changed 10 years ago by
Oops. We reviewed this simultaneously :D. This is what I wrote:
I would simplify this even further. We can always display "Incorrect server response." error. Nothing more.
There are two reasons:
- I don't like the logic with replacing ": %1" with "." or message. What if in some language colon isn't used or sentence does not end with a dot?
- Checking if response format is text/plain does not mean that we know that HTML isn't there. I mean here both XSS and some other failures because we put some weird things that were supposed to be plain text inside notification.
So, I would KISS. Notification is for user, on the console we can log the rest.
As for tests, I think they are ok. Small code style issues:
- https://github.com/cksource/ckeditor-dev/commit/0794c362c080ba2f9aecf48d1d4c5770d6251a0c#diff-4cc646bfce424b3d6ce0181e41147703R179. Space after
"//"
and dot are missing. - https://github.com/cksource/ckeditor-dev/commit/0794c362c080ba2f9aecf48d1d4c5770d6251a0c#diff-4cc646bfce424b3d6ce0181e41147703R187. We usually add a blank line before blocks like this.
comment:10 Changed 10 years ago by
Status: | review_failed → review |
---|
Changes in git:a076149.
I moved the error message to the console.
comment:11 Changed 10 years ago by
Status: | review → review_failed |
---|
comment:12 Changed 10 years ago by
Status: | review_failed → review |
---|
Modified the test so that it expects the behavior that's implemented.
Changes on branch:t/13080
comment:13 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | review → closed |
Fixed on major with git:68643de.
I made small improvements - it's good to teardown a stub, so next tests are not affected.
Changes and tests in branch:t/13080.
Not sure about the test. It works, but it doesn't look clean. Any suggestions how to fix this?