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

Regression in 0.5.0 in escaping back slashes in strings #225

Open
Wavesonics opened this issue May 30, 2023 · 2 comments
Open

Regression in 0.5.0 in escaping back slashes in strings #225

Wavesonics opened this issue May 30, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Wavesonics
Copy link
Contributor

Wavesonics commented May 30, 2023

Serializing a path in 0.4.0 correctly escapes \ but 0.5.0 some times does not get them all.

Here is an example of a failed serialization in 0.5.0:

projectsDirectory = "C:\Users\\foo\\bar"
uiTheme = "FollowSystem"
automaticBackups = true
autoCloseSyncDialog = false
maxBackups = 50
automaticSyncing = true

[nux]
	exampleProjectCreated = true

See that projectsDirectory doesn't have the first \ escaped. When you then try to deserialize it, for some reason I'm getting a NumberFormatException? But what ever, the issue is that on serialization, it is missing the slash for escape.

This is the class being serialized:

@Serializable
data class GlobalSettings(
	val projectsDirectory: String,
	val uiTheme: UiTheme = UiTheme.FollowSystem,
	val automaticBackups: Boolean = true,
	val autoCloseSyncDialog: Boolean = true,
	val maxBackups: Int = DEFAULT_MAX_BACKUPS,
	val automaticSyncing: Boolean = true,
	val nux: NewUserExperience = NewUserExperience()
) {
	companion object {
		const val DEFAULT_MAX_BACKUPS = 50
	}
}

@Serializable
data class NewUserExperience(
	val exampleProjectCreated: Boolean = false
)

enum class UiTheme {
	Light,
	Dark,
	FollowSystem
}
@orchestr7
Copy link
Owner

orchestr7 commented May 30, 2023

Thank you the report, bro! Looks like we have broken that code while were refactoring strings… Will be taken to 0.5.1

@orchestr7 orchestr7 added the bug Something isn't working label Jun 2, 2023
@orchestr7 orchestr7 self-assigned this Jun 2, 2023
@Wavesonics
Copy link
Contributor Author

Crap, I just ran into a very similar error in 0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants