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 11/*
2- * Copyright 2023-2024 the original author or authors.
2+ * Copyright 2023-2025 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -90,7 +90,6 @@ public List<Document> get() {
9090
9191 // Inject source information as a metadata.
9292 this .customMetadata .put (CHARSET_METADATA , this .charset .name ());
93- this .customMetadata .put (SOURCE_METADATA , this .resource .getFilename ());
9493 this .customMetadata .put (SOURCE_METADATA , getResourceIdentifier (this .resource ));
9594
9695 return List .of (new Document (document , this .customMetadata ));
@@ -111,9 +110,7 @@ protected String getResourceIdentifier(Resource resource) {
111110 // Try to get the URI
112111 try {
113112 URI uri = resource .getURI ();
114- if (uri != null ) {
115- return uri .toString ();
116- }
113+ return uri .toString ();
117114 }
118115 catch (IOException ignored ) {
119116 // If getURI() throws an exception, we'll try the next method
@@ -122,9 +119,7 @@ protected String getResourceIdentifier(Resource resource) {
122119 // Try to get the URL
123120 try {
124121 URL url = resource .getURL ();
125- if (url != null ) {
126- return url .toString ();
127- }
122+ return url .toString ();
128123 }
129124 catch (IOException ignored ) {
130125 // If getURL() throws an exception, we'll fall back to getDescription()
You can’t perform that action at this time.
0 commit comments