Skip to content

Commit 14945e0

Browse files
committed
Removed extra backslash when generating namespaces. Caused an issues of too many backslashes resulting in invalid uri's
1 parent 80485c2 commit 14945e0

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
*.txt

src/lib.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ fn process_value(
155155
graph: &mut Graph,
156156
namespace: &String,
157157
) {
158+
159+
let ns = if namespace.ends_with("/") {
160+
namespace
161+
} else {
162+
&([namespace, "/"].join(""))
163+
};
164+
158165
if let Some(last_subject) = subject_stack.clone().back() {
159166
if let Some(prop) = property {
160167
match value {
@@ -204,14 +211,14 @@ fn process_value(
204211

205212
for (key, val) in obj {
206213
let nested_property: Option<String> =
207-
Some(format!("{}/{}", namespace, key));
208-
process_value(subject_stack, &nested_property, val, graph, namespace);
214+
Some(format!("{}{}", ns, key));
215+
process_value(subject_stack, &nested_property, val, graph, ns);
209216
}
210217
subject_stack.pop_back();
211218
}
212219
Value::Array(arr) => {
213220
for val in arr {
214-
process_value(subject_stack, property, val, graph, namespace);
221+
process_value(subject_stack, property, val, graph, ns);
215222
}
216223
}
217224
}

0 commit comments

Comments
 (0)