Skip to content

Commit 0b74f6f

Browse files
Merge branch 'fix/url_safety_net' of https://github.com/Zipstack/unstract into fix/url_safety_net
2 parents 534a577 + c217694 commit 0b74f6f

File tree

4 files changed

+34
-24
lines changed

4 files changed

+34
-24
lines changed

backend/account_v2/templates/login.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@
9494
.logo-box{
9595
width: 100%;
9696
text-align: center;
97-
margin-bottom: 20px;
98-
margin-top: 20px;
97+
margin: 20px 0;
9998
}
10099
.login-heading{
101100
font-size: 24px;
@@ -109,9 +108,8 @@
109108
<!-- Spinner animation -->
110109
<div class="lds-dual-ring"></div>
111110
</div>
112-
{% load static %}
113111
<div class="logo-box">
114-
<img src="{% static 'logo.svg' %}" alt="My image">
112+
<img src="/icons/logo.svg" alt="Unstract Logo">
115113
</div>
116114
<h2 class="login-heading">Login</h2>
117115
{% if error_message %}

backend/workflow_manager/endpoint_v2/destination.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def copy_output_to_output_directory(self) -> None:
321321
except ConnectorError as e:
322322
raise UnstractFSException(core_err=e) from e
323323

324-
def insert_into_db(self, input_file_path: str, error: str | None) -> None:
324+
def insert_into_db(self, input_file_path: str, error: str | None = None) -> None:
325325
"""Insert data into the database."""
326326
connector_instance: ConnectorInstance = self.endpoint.connector_instance
327327
connector_settings: dict[str, Any] = connector_instance.connector_metadata
@@ -345,17 +345,19 @@ def insert_into_db(self, input_file_path: str, error: str | None) -> None:
345345
destination_configurations.get(DestinationKey.EXECUTION_ID, "execution_id")
346346
)
347347

348-
data = self.get_tool_execution_result()
348+
data = self.get_tool_execution_result() if not error else None
349349
metadata = self.get_combined_metadata()
350350

351-
# If no data and no error, don't execute CREATE or INSERT query
352351
if not data and not error:
353352
logger.info("No data obtained from tool to insert into destination DB.")
354353
return
355354

356-
# Remove metadata from result
357-
# Tool text-extractor returns data in the form of string.
358-
# Don't pop out metadata in this case.
355+
# Log when we're proceeding with error insertion
356+
if error and not data:
357+
logger.info(
358+
f"Proceeding with error record insertion for {input_file_path}: {error}"
359+
)
360+
359361
if isinstance(data, dict):
360362
data.pop("metadata", None)
361363

File renamed without changes.

frontend/src/components/custom-tools/pdf-viewer/PdfViewer.jsx

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function PdfViewer({ fileUrl, highlightData, currentHighlightIndex }) {
2020
const pageNavigationPluginInstance = pageNavigationPlugin();
2121
const { jumpToPage } = pageNavigationPluginInstance;
2222
const parentRef = useRef(null);
23+
2324
function removeZerosAndDeleteIfAllZero(highlightData) {
2425
if (Array.isArray(highlightData))
2526
return highlightData?.filter((innerArray) => {
@@ -36,27 +37,36 @@ function PdfViewer({ fileUrl, highlightData, currentHighlightIndex }) {
3637
const processedHighlightData =
3738
processHighlightData?.length > 0 ? processHighlightData : [[0, 0, 0, 0]];
3839

39-
const highlightPluginInstance = useMemo(() => {
40+
// Determine current highlight data
41+
const currentHighlightData = useMemo(() => {
4042
if (
4143
RenderHighlights &&
4244
Array.isArray(processedHighlightData) &&
4345
processedHighlightData?.length > 0
4446
) {
45-
// Only pass the current highlight to render
46-
const currentHighlight =
47-
currentHighlightIndex !== null &&
47+
return currentHighlightIndex !== null &&
4848
currentHighlightIndex < processedHighlightData.length
49-
? [processedHighlightData[currentHighlightIndex]]
50-
: processedHighlightData;
51-
52-
return highlightPlugin({
53-
renderHighlights: (props) => (
54-
<RenderHighlights {...props} highlightData={currentHighlight} />
55-
),
56-
});
49+
? [processedHighlightData[currentHighlightIndex]]
50+
: processedHighlightData;
5751
}
58-
return "";
59-
}, [RenderHighlights, processedHighlightData, currentHighlightIndex]);
52+
return null;
53+
}, [processedHighlightData, currentHighlightIndex]);
54+
55+
// Always create both plugins at top level to maintain hook order
56+
const baseHighlightPlugin = highlightPlugin();
57+
const customHighlightPlugin = highlightPlugin({
58+
renderHighlights:
59+
currentHighlightData && RenderHighlights
60+
? (props) => (
61+
<RenderHighlights {...props} highlightData={currentHighlightData} />
62+
)
63+
: undefined,
64+
});
65+
66+
// Choose which plugin to use
67+
const highlightPluginInstance = currentHighlightData
68+
? customHighlightPlugin
69+
: baseHighlightPlugin;
6070

6171
// Jump to page when highlightData changes or when navigating through highlights
6272
useEffect(() => {

0 commit comments

Comments
 (0)