Skip to content
Merged
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
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 the original author or authors.
* Copyright 2023-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -90,7 +90,6 @@ public List<Document> get() {

// Inject source information as a metadata.
this.customMetadata.put(CHARSET_METADATA, this.charset.name());
this.customMetadata.put(SOURCE_METADATA, this.resource.getFilename());
this.customMetadata.put(SOURCE_METADATA, getResourceIdentifier(this.resource));

return List.of(new Document(document, this.customMetadata));
Expand All @@ -111,9 +110,7 @@ protected String getResourceIdentifier(Resource resource) {
// Try to get the URI
try {
URI uri = resource.getURI();
if (uri != null) {
return uri.toString();
}
return uri.toString();
}
catch (IOException ignored) {
// If getURI() throws an exception, we'll try the next method
Expand All @@ -122,9 +119,7 @@ protected String getResourceIdentifier(Resource resource) {
// Try to get the URL
try {
URL url = resource.getURL();
if (url != null) {
return url.toString();
}
return url.toString();
}
catch (IOException ignored) {
// If getURL() throws an exception, we'll fall back to getDescription()
Expand Down