Skip to content

Commit

Permalink
fix truncating signature on SAS
Browse files Browse the repository at this point in the history
  • Loading branch information
Damion Werner committed Dec 11, 2022
1 parent e0f953b commit a80a5fb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
18 changes: 18 additions & 0 deletions python/tests/test_fs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import urllib

import pyarrow as pa
import pyarrow.parquet as pq
import pytest
Expand Down Expand Up @@ -204,3 +206,19 @@ def test_roundtrip_azure_sas(azurite_sas_creds, sample_data: pa.Table):
table = dt.to_pyarrow_table()
assert table == sample_data
assert dt.version() == 0


@pytest.mark.azure
@pytest.mark.integration
@pytest.mark.timeout(timeout=5, method="thread")
def test_roundtrip_azure_decoded_sas(azurite_sas_creds, sample_data: pa.Table):
table_path = "az://deltars/roundtrip4"
azurite_sas_creds["SAS_TOKEN"] = urllib.parse.unquote(
azurite_sas_creds["SAS_TOKEN"]
)

write_deltalake(table_path, sample_data, storage_options=azurite_sas_creds)
dt = DeltaTable(table_path, storage_options=azurite_sas_creds)
table = dt.to_pyarrow_table()
assert table == sample_data
assert dt.version() == 0
12 changes: 3 additions & 9 deletions rust/src/builder/azure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,10 @@ fn split_sas(sas: &str) -> Result<Vec<(String, String)>, BuilderError> {
.filter(|s| !s.chars().all(char::is_whitespace));
let mut pairs = Vec::new();
for kv_pair_str in kv_str_pairs {
let mut kv = kv_pair_str.trim().split('=');
let k = match kv.next().filter(|k| !k.chars().all(char::is_whitespace)) {
None => {
return Err(BuilderError::MissingCredential);
}
Some(k) => k,
};
let v = match kv.next().filter(|k| !k.chars().all(char::is_whitespace)) {
let kv = kv_pair_str.trim().split_once('=');
let (k, v) = match kv {
None => return Err(BuilderError::MissingCredential),
Some(v) => v,
Some(kv) => kv,
};
pairs.push((k.into(), v.into()))
}
Expand Down

0 comments on commit a80a5fb

Please sign in to comment.