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

Handle release track names containing a colon #1134

Merged
merged 4 commits into from
Jun 28, 2024
Merged

Handle release track names containing a colon #1134

merged 4 commits into from
Jun 28, 2024

Conversation

chimbori
Copy link
Contributor

Handle release track names containing a colon (e.g. wear:alpha) gracefully without crashing.

#1088

For releases named formfactor:track, try formfactor-track.txt and track.txt instead of invalid filename formfactor:track.txt

https://github.com/chimbori/gradle-play-publisher/commit/cb5729afa399e1980231af67cf6670647d479915

[email protected] and others added 3 commits January 3, 2024 20:34
…fully without crashing. #1088

For releases named `formfactor:track`, try `formfactor-track.txt` and `track.txt` instead of invalid filename `formfactor:track.txt`
…fully without crashing. #1088

For releases named `formfactor:track`, try `formfactor-track.txt` and `track.txt` instead of invalid filename `formfactor:track.txt`
@chimbori chimbori requested a review from SUPERCILEX as a code owner June 26, 2024 05:15
val dir = parameters.consoleNamesDir.get()
val file = dir.file("${track.replace(':', '-')}.txt").asFile.orNull()
?: dir.file("${track.substringAfter(':')}.txt").asFile.orNull()
?: dir.file("$track.txt").asFile.orNull()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be removed entirely? If you don't have a file named formfactor-track.txt or track.txt, it's still going to crash with this right as it'll try formfactor:track.txt. Pretty sure track.substringAfter(':') covers track as if there's no colon it'll do nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I’m not sure whether simply calling .file("file:with:colon.txt") will crash or return a null instead, but like you said, since .substringAfter(':') covers this, we can just remove this line.

@SUPERCILEX SUPERCILEX merged commit 75c58a5 into Triple-T:master Jun 28, 2024
4 checks passed
@chimbori chimbori deleted the colon-filename-fix branch June 29, 2024 11:26
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 this pull request may close these issues.

2 participants