Skip to content

Avoiding to use the URL-encoded path #357

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

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public fun isFile(url: URL): Boolean = url.protocol == "file"

public fun asFileOrNull(url: URL): File? = if (isFile(url)) File(url.path) else null

public fun urlAsFile(url: URL): File = File(url.path)
public fun urlAsFile(url: URL): File = File(url.toURI())

public fun isProtocolSupported(url: URL): Boolean = url.protocol in setOf("http", "https", "ftp")
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public fun isFile(url: URL): Boolean = url.protocol == "file"

public fun asFileOrNull(url: URL): File? = if (isFile(url)) File(url.path) else null

public fun urlAsFile(url: URL): File = File(url.path)
public fun urlAsFile(url: URL): File = File(url.toURI())

public fun isProtocolSupported(url: URL): Boolean = url.protocol in setOf("http", "https", "ftp")
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.jetbrains.dataframe.gradle

import com.beust.klaxon.KlaxonException
import io.kotest.assertions.asClue
import io.kotest.assertions.throwables.shouldNotThrowAny
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.assertions.throwables.shouldThrowAny
import io.kotest.matchers.shouldBe
Expand All @@ -13,6 +14,8 @@ import java.io.FileNotFoundException
import java.io.IOException
import java.net.URL
import java.nio.file.Files
import java.nio.file.Paths
import kotlin.io.path.absolutePathString

class DataFrameReadTest {

Expand Down Expand Up @@ -75,10 +78,12 @@ class DataFrameReadTest {
}
}
}

@Test
fun `data accessible and readable`() {
val df = DataFrame.read(File("../../data/jetbrains_repositories.csv"))
shouldNotThrowAny {
DataFrame.read(Paths.get("../../data/jetbrains repositories.csv").absolutePathString())
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ class DataFrameSymbolProcessorTest {
result.successfulCompilation shouldBe false
}

private val jetbrainsCsv = File("../../data/jetbrains_repositories.csv")
private val jetbrainsCsv = File("../../data/jetbrains repositories.csv")

@Test
fun `imported schema resolved`() {
Expand Down