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

Clicking on the View as plain text link in Firefox downloads the log data as a file #520

Closed
polyamide opened this issue Oct 4, 2024 · 5 comments · Fixed by #523
Closed

Comments

@polyamide
Copy link

Jenkins and plugins versions report

Environment
Jenkins: 2.479
OS: Linux - 5.15.0-122-generic
Java: 21.0.4 - Ubuntu (OpenJDK 64-Bit Server VM)
---
ansicolor:1.0.4
ant:511.v0a_a_1a_334f41b_
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
asm-api:9.7-33.v4d23ef79fcc8
audit-trail:361.v82cde86c784e
authentication-tokens:1.119.v50285141b_7e1
blueocean:1.27.16
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.27.16
blueocean-commons:1.27.16
blueocean-config:1.27.16
blueocean-core-js:1.27.16
blueocean-dashboard:1.27.16
blueocean-display-url:2.4.3
blueocean-events:1.27.16
blueocean-git-pipeline:1.27.16
blueocean-github-pipeline:1.27.16
blueocean-i18n:1.27.16
blueocean-jira:1.27.16
blueocean-jwt:1.27.16
blueocean-personalization:1.27.16
blueocean-pipeline-api-impl:1.27.16
blueocean-pipeline-editor:1.27.16
blueocean-pipeline-scm-api:1.27.16
blueocean-rest:1.27.16
blueocean-rest-impl:1.27.16
blueocean-web:1.27.16
bootstrap5-api:5.3.3-1
bouncycastle-api:2.30.1.78.1-248.ve27176eb_46cb_
branch-api:2.1178.v969d9eb_c728e
build-pipeline-plugin:2.0.2
build-timeout:1.33
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.2.1
cloudbees-bitbucket-branch-source:888.v8e6d479a_1730
cloudbees-disk-usage-simple:203.v3f46a_7462b_1a_
cloudbees-folder:6.955.v81e2a_35c08d3
command-launcher:115.vd8b_301cc15d0
commons-compress-api:1.26.1-2
commons-lang3-api:3.17.0-84.vb_b_938040b_078
commons-text-api:1.12.0-129.v99a_50df237f7
conditional-buildstep:1.4.3
copyartifact:749.vfb_dca_a_9b_6549
credentials:1381.v2c3a_12074da_b_
credentials-binding:681.vf91669a_32e45
dashboard-view:2.517.v776a_b_811a_b_4e
data-tables-api:2.1.6-1
display-url-api:2.204.vf6fddd8a_8b_e9
docker-commons:443.v921729d5611d
docker-workflow:580.vc0c340686b_54
dtkit-api:3.0.2
durable-task:577.v2a_8a_4b_7c0247
echarts-api:5.5.1-1
eddsa-api:0.3.0-4.v84c6f0f4969e
email-ext:1844.v3ea_a_b_842374a_
extended-read-permission:53.v6499940139e5
external-monitor-job:215.v2e88e894db_f8
extra-columns:1.26
favorite:2.221.v19ca_666b_62f5
font-awesome-api:6.6.0-2
generic-webhook-trigger:2.2.2
git:5.5.1
git-client:6.0.0
git-server:126.v0d945d8d2b_39
github:1.40.0
github-api:1.321-478.vc9ce627ce001
github-branch-source:1797.v86fdb_4d57d43
gitlab-api:5.6.0-97.v6603a_83f8690
gitlab-branch-source:710.v6f19df32544b_
gitlab-plugin:1.9.2
gradle:2.13
gson-api:2.11.0-41.v019fcf6125dc
handy-uri-templates-2-api:2.1.8-30.v7e777411b_148
htmlpublisher:1.36
instance-identity:201.vd2a_b_5a_468a_a_6
ionicons-api:74.v93d5eb_813d5f
jackson2-api:2.17.0-379.v02de8ec9f64c
jakarta-activation-api:2.1.3-1
jakarta-mail-api:2.1.3-1
javadoc:280.v050b_5c849f69
javax-activation-api:1.2.0-7
javax-mail-api:1.6.2-10
jaxb:2.3.9-1
jdk-tool:80.v8a_dee33ed6f0
jenkins-design-language:1.27.16
jersey2-api:2.44-151.v6df377fff741
jira:3.13
jjwt-api:0.11.5-112.ve82dfb_224b_a_d
jnr-posix-api:3.1.19-2
jobConfigHistory:1268.v75ce751da_911
joda-time-api:2.13.0-85.vb_64d1c2921f1
jquery:1.12.4-1
jquery3-api:3.7.1-2
jsch:0.2.16-86.v42e010d9484b_
json-api:20240303-41.v94e11e6de726
json-path-api:2.9.0-58.v62e3e85b_a_655
junit:1303.v05e2505656b_7
ldap:759.vef7f616475df
locale:519.v4e20f313cfa_f
lockable-resources:1315.v4ea_8e5159ec8
log-parser:2.3.5
mailer:488.v0c9639c1a_eb_3
mapdb-api:1.0.9-40.v58107308b_7a_7
matrix-auth:3.2.2
matrix-project:838.v4d7b_7b_f9b_d4b_
maven-plugin:3.23
mercurial:1260.vdfb_723cdcc81
metrics:4.2.21-451.vd51df8df52ec
mina-sshd-api-common:2.14.0-131.v04e9b_6b_e0362
mina-sshd-api-core:2.14.0-131.v04e9b_6b_e0362
monitoring:1.99.0
okhttp-api:4.11.0-181.v1de5b_83857df
pam-auth:1.11
parameterized-trigger:806.vf6fff3e28c3e
pipeline-agent-build-history:90.vf089ff0feff9
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-github-lib:61.v629f2cc41d83
pipeline-graph-analysis:216.vfd8b_ece330ca_
pipeline-graph-view:349.veda_b_e2366d99
pipeline-groovy-lib:730.ve57b_34648c63
pipeline-input-step:495.ve9c153f6067b_
pipeline-milestone-step:119.vdfdc43fc3b_9a_
pipeline-model-api:2.2214.vb_b_34b_2ea_9b_83
pipeline-model-definition:2.2214.vb_b_34b_2ea_9b_83
pipeline-model-extensions:2.2214.vb_b_34b_2ea_9b_83
pipeline-rest-api:2.34
pipeline-stage-step:312.v8cd10304c27a_
pipeline-stage-tags-metadata:2.2214.vb_b_34b_2ea_9b_83
pipeline-stage-view:2.34
pipeline-utility-steps:2.17.0
plain-credentials:183.va_de8f1dd5a_2b_
plugin-util-api:5.1.0
pubsub-light:1.18
resource-disposer:0.24
role-strategy:743.v142ea_b_d5f1d3
run-condition:1.7
scm-api:696.v778d637b_a_762
script-security:1362.v67dc1f0e1b_b_3
slave-setup:1.16
snakeyaml-api:2.3-123.v13484c65210a_
sse-gateway:1.27
ssh-credentials:343.v884f71d78167
ssh-slaves:2.973.v0fa_8c0dea_f9f
ssh-steps:2.0.68.va_d21a_12a_6476
sshd:3.330.vc866a_8389b_58
structs:338.v848422169819
subversion:1275.va_7b_014f3fc2c
timestamper:1.27
token-macro:400.v35420b_922dcb_
trilead-api:2.147.vb_73cc728a_32e
variant:60.v7290fc0eb_b_cd
view-job-filters:382.vdf2d5e3f02f0
workflow-aggregator:600.vb_57cdd26fdd7
workflow-api:1336.vee415d95c521
workflow-basic-steps:1058.vcb_fc1e3a_21a_9
workflow-cps:3969.vdc9d3a_efcc6a_
workflow-durable-task-step:1371.vb_7cec8f3b_95e
workflow-job:1441.vb_2d416905b_35
workflow-multibranch:795.ve0cb_1f45ca_9a_
workflow-scm-step:427.v4ca_6512e7df1
workflow-step-api:678.v3ee58b_469476
workflow-support:926.v9f4f9b_b_98c19
ws-cleanup:0.46
xunit:3.1.5

What Operating System are you using (both controller, and any agents involved in the problem)?

Jenkins: Ubuntu 22.04.5 LTS
Client: Windows 11, 10.0.22631
Browser: Firefox 131.0

Reproduction steps

  1. in the Firefox browser select any pipeline build
  2. go to Pipeline Overview
  3. select any stage
  4. click on "View as plain text"

Expected Results

The log text is displayed in the Firefox browser.

Actual Results

Firefox downloads the log data as a file named "log".

Anything else?

This problem does not occur with the Edge browser.

When I configure Firefox to ask what to do with unknown file types and click the "View as plain text" link again, FF says that file "log" has the type "application/octet-stream".

Are you interested in contributing a fix?

No response

@KalleOlaviNiemitalo
Copy link

I don't see this bug on Jenkins 2.462.3.

The Pipeline Graph View plugin links to the consoleText URL but the streaming is implemented in the Jenkins core. Between Jenkins 2.462.3 and 2.479, the implementation of Run.doConsoleText was changed in jenkinsci/jenkins#9672; perhaps that caused the problem.

workflow-job 1441.vb_2d416905b_35 overrides doConsoleText and calls rsp.setContentType("text/plain;charset=UTF-8"). It hasn't yet migrated from StaplerResponse to StaplerResponse2: https://github.com/jenkinsci/workflow-job-plugin/blob/b2d416905b35cd2862b3edf2ed5011953937515b/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java#L1131-L1136. However, StaplerResponseWrapperImpl.setContentType looks like it should forward the call to StaplerResponse2: https://github.com/jenkinsci/stapler/blob/c4f6b569053629f8ede0e176bce6538a2450585f/core/src/main/java/org/kohsuke/stapler/StaplerResponse.java#L912-L915

@MarkEWaite
Copy link
Contributor

I can't duplicate the problem with Firefox 131.0 on my Windows computer when running Jenkins 2.479 with most recent releases of plugins for Pipeline, including Pipeline graph view.

Firefox 131.0 behaves the same as Google Chrome for me. When I

  1. in the Firefox browser select any pipeline build
  2. go to Pipeline Overview
  3. select any stage
  4. click on "View as plain text"

The page is replaced with the text of the console log. It does not download a file, at least not in my environment.

@basil
Copy link
Member

basil commented Oct 5, 2024

the implementation of Run.doConsoleText was changed in jenkinsci/jenkins#9672; perhaps that caused the problem

Actually, it was jenkinsci/jenkins#9379.

@basil
Copy link
Member

basil commented Oct 5, 2024

@MarkEWaite To trigger the change in behavior, you need a step with at least 4K of logs. The behavior before jenkinsci/jenkins#9379 was to use an uncompressed writer for under 4K of logs (which would result in no download) and a compressed writer for 4K or more of logs (which would result in a download). As of jenkinsci/jenkins#9379 compression is delegated to Jetty, which decides to always compress (which always results in a download). This is certainly a change in behavior, but I am not sure it is an undesirable one.

@basil
Copy link
Member

basil commented Oct 5, 2024

This is a pre-existing bug in pipeline-graph-view, which forgets to set the content type as in https://github.com/jenkinsci/workflow-job-plugin/blob/38410d755a27ac1afa2ddff481d5fa318402f369/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java#L1132. Previously, this bug was not visible unless compression kicked in (for requests over 4K), but now that compression is always enabled the bug is always visible. The fix is simple: to set the content type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants