Skip to content
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

Swagger UI don't show in dev mode from 2.7.0.Final #23991

Closed
yuhaibohotmail opened this issue Feb 26, 2022 · 27 comments · Fixed by #24025
Closed

Swagger UI don't show in dev mode from 2.7.0.Final #23991

yuhaibohotmail opened this issue Feb 26, 2022 · 27 comments · Fixed by #24025
Assignees
Labels
area/devmode area/swagger-ui env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@yuhaibohotmail
Copy link

Describe the bug

Chrome console error log:

deburr.js:5 Uncaught SyntaxError: Invalid regular expression: /['鈥橾/: Unterminated character class
    at RegExp (<anonymous>)
    at Object.<anonymous> (deburr.js:5:15)
    at n (bootstrap:19:22)
    at Object.<anonymous> (xml.js:2:5)
    at n (bootstrap:19:22)
    at Object.<anonymous> (swagger-ui-bundle.js:2:59658)
    at Object.<anonymous> (swagger-ui-bundle.js:2:70295)
    at n (bootstrap:19:22)
    at Module.<anonymous> (system.js:34:3)
    at n (bootstrap:19:22)

Expected behavior

Show swagger ui

Actual behavior

Swagger UI don't Show in dev mode .
it works for versions prior to 2.7.0.CR1 in dev mode.

How to Reproduce?

openapibug.zip

Output of uname -a or ver

Microsoft Windows [ 10.0.19043.1165]

Output of java -version

Java(TM) SE Runtime Environment 18.9 (build 11.0.7+8-LTS)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.7.2.final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)

Additional information

No response

@yuhaibohotmail yuhaibohotmail added the kind/bug Something isn't working label Feb 26, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 26, 2022

/cc @MikeEdgar, @phillip-kruger

@phillip-kruger
Copy link
Member

Hi @yuhaibohotmail - so you are using '鈥橾' in the output somewhere? Do you have a reproducer ?

@yuhaibohotmail
Copy link
Author

yuhaibohotmail commented Feb 27, 2022

Hi @yuhaibohotmail - so you are using '鈥橾' in the output somewhere? Do you have a reproducer ?

nothing.
I used "https://code.quarkus.io/" generate the project.

here is a reproducer
openapibug.zip

@phillip-kruger
Copy link
Member

ok thanks. I'll have a look.

@phillip-kruger phillip-kruger self-assigned this Feb 27, 2022
@phillip-kruger
Copy link
Member

Hi @yuhaibohotmail - i could not recreate this. Your reproducer works fine. Can you share some more details ?
Peek 2022-02-28 10-41

@yuhaibohotmail
Copy link
Author

Hi @phillip-kruger , This bug only appears on Windows in dev mode, it works fine on MacOS

1.mp4
2.mp4

@phillip-kruger
Copy link
Member

Ok, I'll see if I can recreate on Windows.

@yuhaibohotmail
Copy link
Author

I find '鈥橾' in swagger-ui-bundle.js
image

@gsmet
Copy link
Member

gsmet commented Feb 28, 2022

@phillip-kruger I can't find the issue but someone also complained they had ^A characters in the UI on Windows (and it was a regression in 2.7, apparently).

I wonder if it's a charset related issue.

@yuhaibohotmail what is your locale/charset on Windows?

@yuhaibohotmail
Copy link
Author

@phillip-kruger I can't find the issue but someone also complained they had ^A characters in the UI on Windows (and it was a regression in 2.7, apparently).

I wonder if it's a charset related issue.

@yuhaibohotmail what is your locale/charset on Windows?

image

My locale is zh-CN.
I just tested it work on Microsoft Edge (V98.0.1108.62) in dev mode,and can not work on firefox(V97.0.1).

@phillip-kruger
Copy link
Member

Ok, I think this is bigger than openapi and graphql, we might need some help from someone in the vertx-http or similar extension. I have not yet managed to recreate this issue, but I left the locale/charset as default on Windows. I'll try again. @stuartwdouglas @cescoffier - do you have any idea if anything changed ?

@phillip-kruger
Copy link
Member

@yuhaibohotmail I am struggling to recreate the issue:
image

@stuartwdouglas
Copy link
Member

I don't see that character in the file (in smallrye-open-api-ui-2.1.17.jar). I don't really see how this could be a charset issue, this should be served just using the vert.x static file handler, no charset processing should be done.

@stuartwdouglas
Copy link
Member

In my editor it looks like:

o=n(434),u=RegExp("['’]","g") rather than what you are seeing, but the back tick is 'U+2019'

@phillip-kruger
Copy link
Member

@gsmet - There is no difference between the headers in 2.7.0 and 2.7.2 that I can see.

@yuhaibohotmail
Copy link
Author

swagger-ui-bundle.zip

This is the js file I get from chrome
image

@stuartwdouglas
Copy link
Member

Any idea what your default encoding is?

@phillip-kruger
Copy link
Member

And you mentioned it works on Edge ? But not on Chrome and Firefox ?

@stuartwdouglas
Copy link
Member

E.g. what happens if you run:
System.out.println(new String("\u2019".getBytes(StandardCharsets.UTF_8)));

@stuartwdouglas
Copy link
Member

The browser is interpretting it as either GBK or GB18030

If you do: System.out.println(new String("\u2019]".getBytes(StandardCharsets.UTF_8), "GB18030")); you get 鈥橾

@yuhaibohotmail
Copy link
Author

swagger-ui-bundle.zip
This is js file I get from chrome in product mode,can not find the character

@stuartwdouglas
Copy link
Member

What headers do you see in the network tab of chrome?

@yuhaibohotmail
Copy link
Author

The browser is interpretting it as either GBK or GB18030

If you do: System.out.println(new String("\u2019]".getBytes(StandardCharsets.UTF_8), "GB18030")); you get 鈥橾

System.out.println(new String("\u2019".getBytes(StandardCharsets.UTF_8)));
I get 鈥�

System.out.println(new String("\u2019]".getBytes(StandardCharsets.UTF_8), "GB18030"));
I get 鈥橾

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Mar 1, 2022
@yuhaibohotmail
Copy link
Author

And you mentioned it works on Edge ? But not on Chrome and Firefox ?

yes , it works on Edge in dev mode.

@stuartwdouglas
Copy link
Member

Linked PR should fix the issue.

@yuhaibohotmail
Copy link
Author

@stuartwdouglas Thanks a lot !

@yuhaibohotmail
Copy link
Author

@stuartwdouglas
I just tried that fix,it works for me。

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Mar 1, 2022
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Mar 1, 2022
@gsmet gsmet modified the milestones: 2.8 - main, 2.7.3.Final Mar 1, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devmode area/swagger-ui env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants