Fix dump during "New Online" (#4977)

* Fix dump during "New Online" 

I accidentally used a copied link `sapevent:url?url=https://github.com/abapGit-tests/TABL` into the "New Online" diaplog. AG would dump in this case.

Now you get a proper error message.

* Strip leading/trailing spaces for URLs

* Add

* Update

Co-authored-by: Lars Hvam <larshp@hotmail.com>
Co-authored-by: g-back <27279305+g-back@users.noreply.github.com>
This commit is contained in:
Marc Bernard 2021-10-02 03:09:18 -04:00 committed by GitHub
parent 84e6971bf8
commit b41831868f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 11 deletions

View File

@ -96,6 +96,7 @@ CLASS zcl_abapgit_gui_page_addonline IMPLEMENTATION.
ro_form->text(
iv_name = c_id-url
iv_required = abap_true
iv_condense = abap_true
iv_label = 'Git Repository URL'
iv_hint = 'HTTPS address of the repository'
iv_placeholder = 'https://github.com/...git'

View File

@ -467,6 +467,7 @@ CLASS zcl_abapgit_gui_page_sett_remo IMPLEMENTATION.
iv_readonly = abap_true
)->text(
iv_name = c_id-url
iv_condense = abap_true
iv_label = lv_label
iv_hint = lv_hint
iv_placeholder = lv_placeholder ).

View File

@ -36,6 +36,7 @@ CLASS zcl_abapgit_html_form DEFINITION
!iv_upper_case TYPE abap_bool DEFAULT abap_false
!iv_readonly TYPE abap_bool DEFAULT abap_false
!iv_password TYPE abap_bool DEFAULT abap_false
!iv_condense TYPE abap_bool OPTIONAL
!iv_placeholder TYPE csequence OPTIONAL
!iv_side_action TYPE csequence OPTIONAL
!iv_min TYPE i DEFAULT cl_abap_math=>min_int4
@ -817,6 +818,7 @@ CLASS zcl_abapgit_html_form IMPLEMENTATION.
ls_field-min = iv_min.
ls_field-max = iv_max.
ls_field-password = iv_password.
ls_field-condense = iv_condense.
ls_field-hint = iv_hint.
ls_field-required = iv_required.
ls_field-placeholder = iv_placeholder.

View File

@ -59,7 +59,7 @@ ENDCLASS.
CLASS ZCL_ABAPGIT_HTML_FORM_UTILS IMPLEMENTATION.
CLASS zcl_abapgit_html_form_utils IMPLEMENTATION.
METHOD constructor.
@ -169,6 +169,10 @@ CLASS ZCL_ABAPGIT_HTML_FORM_UTILS IMPLEMENTATION.
LOOP AT lt_fields ASSIGNING <ls_field> WHERE type <> zif_abapgit_html_form=>c_field_type-field_group.
CLEAR lv_value.
lv_value = io_form_data->get( <ls_field>-name ).
IF <ls_field>-condense = abap_true.
lv_value = condense( val = lv_value
del = ` ` ).
ENDIF.
IF <ls_field>-type = zif_abapgit_html_form=>c_field_type-checkbox.
ro_form_data->set(
@ -241,6 +245,10 @@ CLASS ZCL_ABAPGIT_HTML_FORM_UTILS IMPLEMENTATION.
lt_fields = mo_form->get_fields( ).
LOOP AT lt_fields ASSIGNING <ls_field>.
lv_value = io_form_data->get( <ls_field>-name ).
IF <ls_field>-condense = abap_true.
lv_value = condense( val = lv_value
del = ` ` ).
ENDIF.
IF <ls_field>-required IS NOT INITIAL AND lv_value IS INITIAL.
ro_validation_log->set(
iv_key = <ls_field>-name

View File

@ -26,6 +26,7 @@ INTERFACE zif_abapgit_html_form
subitems TYPE ty_subitems,
readonly TYPE abap_bool,
password TYPE abap_bool,
condense TYPE abap_bool,
min TYPE i,
max TYPE i,
END OF ty_field .

View File

@ -119,10 +119,10 @@ CLASS zcl_abapgit_url IMPLEMENTATION.
METHOD regex.
FIND REGEX '(https?://[^/]*)(.*/)(.*)\.git$' IN iv_url
FIND REGEX '^(https?://[^/]*)(.*/)(.*)\.git$' IN iv_url
SUBMATCHES ev_host ev_path ev_name.
IF sy-subrc <> 0.
FIND REGEX '(https?://[^/]*)(.*/)(.*)$' IN iv_url
FIND REGEX '^(https?://[^/]*)(.*/)(.*)$' IN iv_url
SUBMATCHES ev_host ev_path ev_name.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Malformed URL' ).
@ -132,14 +132,6 @@ CLASS zcl_abapgit_url IMPLEMENTATION.
ENDMETHOD.
METHOD validate.
name( iv_url = iv_url
iv_validate = abap_true ).
ENDMETHOD.
METHOD url_address.
DATA:
@ -167,4 +159,10 @@ CLASS zcl_abapgit_url IMPLEMENTATION.
ENDMETHOD.
METHOD validate.
name( iv_url = iv_url
iv_validate = abap_true ).
ENDMETHOD.
ENDCLASS.