put_object für leere und nicht leere dateien getestet und korrigiert

This commit is contained in:
2026-04-23 15:27:52 +02:00
parent 5098dd38a5
commit 93191ec65d

View File

@@ -131,6 +131,8 @@ create or replace package body pck_net_storage as
l_header_index number := 1; l_header_index number := 1;
l_content_length number; l_content_length number;
begin begin
-- headers zurücksetzen - nur zur Sicherheit, damit keine alten Header übertragen werden.
apex_web_service.g_request_headers.delete;
if i_content_type is not null if i_content_type is not null
then then
@@ -159,10 +161,13 @@ create or replace package body pck_net_storage as
l_header_index := l_header_index + 1; l_header_index := l_header_index + 1;
*/ */
-- nur für BLOB (z.B. leerer Ordner) Content-Length setzen -- nur für leere BLOBs (z.B. leerer Ordner) Content-Length setzen
if i_body_blob is not null -- bei nicht leeren blob setzt apex_web_service.make_rest_request den content-length header automatisch, doppeltes setzen führt aber zu einem HTTP-400 API Fehler
-- bei leeren blobs (empty_blob()) wird er aber nicht automatisch gesetzt, daher müssen wir ihn manuell setzen
if i_body_blob is not null
and dbms_lob.getlength(i_body_blob) = 0
then then
l_content_length := coalesce(dbms_lob.getlength(i_body_blob), 0); l_content_length := 0; -- coalesce(dbms_lob.getlength(i_body_blob), 0);
apex_web_service.g_request_headers(l_header_index).name := 'Content-Length'; apex_web_service.g_request_headers(l_header_index).name := 'Content-Length';
apex_web_service.g_request_headers(l_header_index).value := l_content_length; apex_web_service.g_request_headers(l_header_index).value := l_content_length;
l_header_index := l_header_index + 1; l_header_index := l_header_index + 1;
@@ -172,8 +177,8 @@ create or replace package body pck_net_storage as
if i_body_clob is not null if i_body_clob is not null
then then
apex_debug.info('Clob Request Body used:'); --apex_debug.info('Clob Request Body used:');
apex_debug.info(i_body_clob); --apex_debug.info(i_body_clob);
l_response := apex_web_service.make_rest_request( l_response := apex_web_service.make_rest_request(
p_url => i_url p_url => i_url
,p_http_method => i_method ,p_http_method => i_method
@@ -182,7 +187,7 @@ create or replace package body pck_net_storage as
,p_wallet_path => pck_system.f_get_par_wert_by_programmid('NETSTORE_WALLET_PATH') ,p_wallet_path => pck_system.f_get_par_wert_by_programmid('NETSTORE_WALLET_PATH')
); );
else else
apex_debug.info('BLOB Request Body used! Length: ' || dbms_lob.getlength(i_body_blob)); --apex_debug.info('BLOB Request Body used! Length: ' || dbms_lob.getlength(i_body_blob));
l_response := apex_web_service.make_rest_request( l_response := apex_web_service.make_rest_request(
p_url => i_url p_url => i_url
,p_http_method => i_method ,p_http_method => i_method
@@ -545,13 +550,12 @@ create or replace package body pck_net_storage as
raise_application_error(-20012, 'Object Key darf nicht mit / enden — zum Anlegen von Ordnern p_create_folder verwenden'); raise_application_error(-20012, 'Object Key darf nicht mit / enden — zum Anlegen von Ordnern p_create_folder verwenden');
end if; end if;
-- TEST l_response := f_make_request(
--l_response := f_make_request( i_method => 'PUT'
-- i_method => 'PUT' ,i_url => f_build_url(i_object_key)
-- ,i_url => f_build_url(i_object_key) ,i_body_blob => i_content
-- ,i_body_blob => i_content ,i_content_type => i_content_type
-- ,i_content_type => i_content_type );
--);
l_obj_path := f_split_object_key(i_object_key); l_obj_path := f_split_object_key(i_object_key);
pck_log.p_info( pck_log.p_info(