Skip to content

Commit 8dde53b

Browse files
authored
Merge pull request #29 from cryptosense/add-compatibility-with-seaweedfs
Add compatibility with seaweedfs
2 parents 5d5d788 + 4e6547c commit 8dde53b

4 files changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/main.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ${{ matrix.os }}
1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2222
- name: Retrieve new lists of system packages
2323
if: runner.os != 'Windows'
2424
run: sudo apt-get update
@@ -38,4 +38,13 @@ jobs:
3838
- run: opam pin add cs_api_client.dev . --no-action
3939
- run: opam depext cs_api_client --yes --with-test
4040
- run: opam install . --deps-only --with-test
41+
- name: Tag substitution
42+
run: bash ./ci/subst.bash "${{ github.ref_name }}"
43+
if: startsWith(github.ref, 'refs/tags/')
4144
- run: opam exec -- dune build @all @fmt @runtest
45+
- name: Upload compiled binary
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: cs-api-${{ matrix.os }}
49+
path: _build/install/default/bin/*
50+
if-no-files-found: error

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
99

1010
_There are no unreleased changes at the moment._
1111

12+
## [2.5.1] - 2023-11-08
13+
14+
### Fixed
15+
16+
* Fix compatibility with SeaweedFS API responses
17+
1218
## [2.5.0] - 2023-10-19
1319

1420
### Fixed

cs_api_core/cs_api_core.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ let parse_s3_signature_request ~body =
191191

192192
let parse_s3_response ~body =
193193
try
194-
let key_extractor = Str.regexp "<Key>\\([^<>]*\\)</Key>" in
194+
let key_extractor = Str.regexp "<Key.*>\\([^<>]*\\)</Key>" in
195195
let _ = Str.search_forward key_extractor body 0 in
196196
Ok (Str.matched_group 1 body)
197197
with

test/test_key_extractor.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,12 @@ let tests =
2424
<PostResponse><Bucket>cryptosense-traces</Bucket><Key>uploads/784f2aa928404db3a958fbd779a44156</Key><ETag>&#34;82887f4dd13a80e182aa01efc0a59e9e&#34;</ETag><Location>http://localhost:9000/cryptosense-traces/uploads/784f2aa928404db3a958fbd779a44156</Location></PostResponse>
2525
|}
2626
~expected:(Ok "uploads/784f2aa928404db3a958fbd779a44156")
27+
; test_body ~name:"Valid SeaweedFS body"
28+
~body:
29+
{|
30+
<?xml version="1.0" encoding="UTF-8"?>
31+
<PostResponse><Location xmlns="http://s3.amazonaws.com/doc/2006-03-01/"></Location><Bucket xmlns="http://s3.amazonaws.com/doc/2006-03-01/">storage-traces</Bucket><Key xmlns="http://s3.amazonaws.com/doc/2006-03-01/">uploads/48db212785054589966f84565a263e90</Key><ETag xmlns="http://s3.amazonaws.com/doc/2006-03-01/">&#34;4425e01772cfdca990eff5f085d05414&#34;</ETag></PostResponse>
32+
|}
33+
~expected:(Ok "uploads/48db212785054589966f84565a263e90")
2734
; test_body ~name:"Invalid body" ~body:"This\ndoes not\ncontain a key."
2835
~expected:(Error "Key could not be extracted from S3 response.") ]

0 commit comments

Comments
 (0)