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

Bug 1894374: prevent prevent loading by type #7099

Merged

Conversation

yaacov
Copy link
Member

@yaacov yaacov commented Nov 4, 2020

The file to upload using the upload screen does not have to have any extension, it is quite normal to have a raw file without any extension (e.g. my-fedora-disk and not my-fedora-disk.img). The problem is, that we block the user from uploading such a file with an error.

Screenshots:
After:
Peek 2020-11-04 10-28

Before:
Peek 2020-11-04 09-41

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Nov 4, 2020
@openshift-ci-robot
Copy link
Contributor

@yaacov: This pull request references Bugzilla bug 1894374, which is invalid:

  • expected the bug to target the "4.7.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1894374: prevent prevent loading by type

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the component/kubevirt Related to kubevirt-plugin label Nov 4, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 4, 2020
@yaacov
Copy link
Member Author

yaacov commented Nov 4, 2020

@matthewcarleton @glekner @pcbailey please review

@yaacov
Copy link
Member Author

yaacov commented Nov 4, 2020

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Nov 4, 2020
@openshift-ci-robot
Copy link
Contributor

@yaacov: This pull request references Bugzilla bug 1894374, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@yaacov
Copy link
Member Author

yaacov commented Nov 5, 2020

@matthewcarleton I added a hint about the file extensions as you suggested in Jira, please re review:
screenshot-localhost_9000-2020 11 05-12_30_17
screenshot-localhost_9000-2020 11 05-12_31_25

/retest

@matthewcarleton
Copy link
Contributor

@yaacov yes that's better :)
Can you also use an inline alert (.pf-m-inline)

@yaacov
Copy link
Member Author

yaacov commented Nov 6, 2020

Can you also use an inline alert (.pf-m-inline)

Thanks, inline now, please re-review:
screenshot-localhost_9000-2020 11 06-11_48_05

@matthewcarleton
Copy link
Contributor

lgtm!

@@ -529,6 +513,9 @@ export const UploadPVCPage: React.FC<UploadPVCPageProps> = (props) => {
const handleFileChange = (value, filename) => {
setFileName(filename);
setFileValue(value);

setFileNameExtension(/[.][^.]+$/.exec(filename)?.toString());
setIsFileRejected(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when is isFileRejected true? @yaacov

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is set by the UploadPVCForm when file extension is unexpected, but is not reset back on field clear, this line reset it back when the offending file is cleared but no new file is selected.

@glekner
Copy link
Contributor

glekner commented Nov 9, 2020

@yaacov please squash the commits so I can lgtm

@yaacov yaacov force-pushed the prevent-prevent-pvc-loading branch from e160b45 to 78e1498 Compare November 9, 2020 16:50
@yaacov
Copy link
Member Author

yaacov commented Nov 9, 2020

please squash the commits so I can lgtm

@glekner squashed 👍

@yaacov
Copy link
Member Author

yaacov commented Nov 9, 2020

/retest

</p>
</Alert>
) : (
undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why ternary condition?
just do isFileRejected &&

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isFileRejected is boolean, so if we use && we get into a grey area of how to render false [1] , I preferred here to be explicit and make sure I understand isFileRejected is boolean, by explicitly render {undefined} instead of false which is redundant but explicit. On the other hand it does looks prettier with && so changing to using && 👍

[1] https://react-cn.github.io/react/tips/false-in-jsx.html

@yaacov
Copy link
Member Author

yaacov commented Nov 10, 2020

/retest

1 similar comment
@yaacov
Copy link
Member Author

yaacov commented Nov 10, 2020

/retest

@glekner
Copy link
Contributor

glekner commented Nov 10, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 10, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: glekner, yaacov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

3 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@yaacov
Copy link
Member Author

yaacov commented Nov 10, 2020

/retest

2 similar comments
@yaacov
Copy link
Member Author

yaacov commented Nov 10, 2020

/retest

@yaacov
Copy link
Member Author

yaacov commented Nov 10, 2020

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

6 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 9e05d80 into openshift:master Nov 11, 2020
@openshift-ci-robot
Copy link
Contributor

@yaacov: All pull requests linked via external trackers have merged:

Bugzilla bug 1894374 has been moved to the MODIFIED state.

In response to this:

Bug 1894374: prevent prevent loading by type

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.7 milestone Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/kubevirt Related to kubevirt-plugin lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants