File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
spring-ai-commons/src/main/java/org/springframework/ai/reader Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2023-2024 the original author or authors.
2
+ * Copyright 2023-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -90,7 +90,6 @@ public List<Document> get() {
90
90
91
91
// Inject source information as a metadata.
92
92
this .customMetadata .put (CHARSET_METADATA , this .charset .name ());
93
- this .customMetadata .put (SOURCE_METADATA , this .resource .getFilename ());
94
93
this .customMetadata .put (SOURCE_METADATA , getResourceIdentifier (this .resource ));
95
94
96
95
return List .of (new Document (document , this .customMetadata ));
@@ -111,9 +110,7 @@ protected String getResourceIdentifier(Resource resource) {
111
110
// Try to get the URI
112
111
try {
113
112
URI uri = resource .getURI ();
114
- if (uri != null ) {
115
- return uri .toString ();
116
- }
113
+ return uri .toString ();
117
114
}
118
115
catch (IOException ignored ) {
119
116
// If getURI() throws an exception, we'll try the next method
@@ -122,9 +119,7 @@ protected String getResourceIdentifier(Resource resource) {
122
119
// Try to get the URL
123
120
try {
124
121
URL url = resource .getURL ();
125
- if (url != null ) {
126
- return url .toString ();
127
- }
122
+ return url .toString ();
128
123
}
129
124
catch (IOException ignored ) {
130
125
// If getURL() throws an exception, we'll fall back to getDescription()
You can’t perform that action at this time.
0 commit comments