Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty Expiration date results in "invalid date" entry #32056

Closed
individual-it opened this issue Jul 16, 2018 · 11 comments · Fixed by #32540
Closed

empty Expiration date results in "invalid date" entry #32056

individual-it opened this issue Jul 16, 2018 · 11 comments · Fixed by #32540
Assignees
Labels
p3-medium Normal priority Type:Bug
Milestone

Comments

@individual-it
Copy link
Member

Steps to reproduce

  1. enforce public link expiration date
  2. create a new public link, delete the expiration date
  3. click Share
  4. click Share again
  5. click Cancel
  6. view the settings of new link

Expected behaviour

the UI should tell you that the expiration date is required and let you enter a correct date

Actual behaviour

after point 3 its not possible to enter a new date
image

after point 6 "Invalid date" is shown
image

problem happens only on master branch, cannot reproduce on stable10

Server configuration

Operating system:
Ubuntu 17.10

Web server:
Apache

Database:
MySQL

PHP version:
7.1

ownCloud version: (see ownCloud admin page)
10.1 (master branch)

Updated from an older ownCloud or fresh install:
fresh

Where did you install ownCloud from:
git

The content of config/config.php:

{
    "system": {
        "license-key": "***REMOVED SENSITIVE VALUE***",
        "instanceid": "ocuv4s8d5xsv",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost"
        ],
        "datadirectory": "\/home\/artur\/www\/owncloud-core\/data",
        "overwrite.cli.url": "http:\/\/localhost\/owncloud-core",
        "dbtype": "mysql",
        "version": "10.1.0.1",
        "logtimezone": "UTC",
        "installed": true,
        "theme": "",
        "loglevel": 1,
        "maintenance": false,
        "skeletondirectory": "\/home\/artur\/www\/owncloud-core\/tests\/acceptance\/skeleton",
        "default_language": "en",
        "singleuser": false,
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "1025",
        "csrf.disabled": "true",
        "ldapIgnoreNamingRules": false,
        "sharing.federation.allowHttpFallback": true,
        "files_external_allow_create_new_local": "true",
        "enable_previews": false,
        "cors.allowed-domains": [
            "http:\/\/localhost:8300"
        ],
        "dbname": "owncloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated apps:

Enabled:
  - comments: 0.3.0
  - dav: 0.3.2
  - diagnostics: 0.1.0
  - enterprise_key: 0.1.4
  - federatedfilesharing: 0.3.1
  - federation: 0.1.0
  - files: 1.5.1
  - files_external: 0.7.1
  - files_sharing: 0.10.1
  - files_texteditor: 2.2.1
  - files_trashbin: 0.9.1
  - files_versions: 1.3.0
  - firewall: 2.5.0
  - gallery: 16.0.2
  - market: 0.2.3
  - notifications: 0.3.3
  - provisioning_api: 0.5.0
  - systemtags: 0.3.0
  - updatenotification: 0.2.1
  - windows_network_drive: 0.7.0
Disabled:
  - customgroups
  - files_antivirus
  - files_primary_s3
  - guests
  - multidirtest
  - oauth2
  - password_policy
  - security
  - testing
  - user_ldap
  - user_management

Are you using external storage, if yes which one: local/smb/sftp/...
local

Are you using encryption: yes/no
no
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
no

Client configuration

Browser:
FF 61

Operating system:
Ununtu 17.10

Logs

Browser log

after point 3 POST Request:

field data
expireDate  
name FOLDER link
path /FOLDER
permissions 1
shareType 3

Response:

{"ocs":{"meta":{"status":"ok","statuscode":200,"message":null},"data":{"id":"5","share_type":3,"uid_owner":"admin","displayname_owner":"admin","permissions":1,"stime":1531741345,"parent":null,"expiration":"2018-07-23 00:00:00","token":"3LLLdfwFBIsxrm8","uid_file_owner":"admin","displayname_file_owner":"admin","path":"\/FOLDER","item_type":"folder","mimetype":"httpd\/unix-directory","storage_id":"home::admin","storage":1,"item_source":"9","file_source":"9","file_parent":"2","file_target":"\/FOLDER","share_with":null,"share_with_displayname":null,"name":"FOLDER link","url":"http:\/\/localhost\/owncloud-core\/index.php\/s\/3LLLdfwFBIsxrm8","mail_send":0}}}

after point 4 PUT request:

field data
expireDate  
name FOLDER link
permissions 1
shareType 3

response:

{"ocs":{"meta":{"status":"failure","statuscode":400,"message":"Expiration date is enforced"},"data":[]}}
@PVince81 PVince81 added Type:Bug p3-medium Normal priority labels Jul 27, 2018
@PVince81 PVince81 added this to the backlog milestone Jul 27, 2018
@PVince81 PVince81 modified the milestones: backlog, development Aug 7, 2018
@felixheidecke
Copy link
Contributor

hmmm ... just found out that sharing accepts null as a valid date 🤔

@felixheidecke
Copy link
Contributor

Next fun(k)y thing. It still saves even tho validation returns an error 🤔

@felixheidecke
Copy link
Contributor

felixheidecke commented Aug 30, 2018

As the ShareDialogExpirationView "extends" the ShareDialogLinkListView and changes the model $datepicker.on('change', ... in order to promote it's contribution to the form, the model gets updated before the save and validation happens. So if we close and re-open the modal again, the model remains changed and a error appears on parsing the errenous date in the datepicker.

The greater problem is, that the real state of the share is not being shown. Only until a hard reload that is.

@felixheidecke
Copy link
Contributor

@PVince81 I guess we would have to re-fetch the model from the backend upon opening the modal?

@felixheidecke
Copy link
Contributor

Or a rewrite in vue.js? 🤔

@PVince81
Copy link
Contributor

hmm, does it mean we don't update the model upon closing the dialog ?

or is the unsaved model kept somehow and reused upon reopening the dialog, in which case we need to reset it back to its original values ?

@felixheidecke
Copy link
Contributor

The model is updated on save which is to be expected. But ShareDialogExpirationView updates the model on change and it remains changed on closing.

I there an easy way to re-fetch? Couldn't find any XHR going back and forth.

@felixheidecke
Copy link
Contributor

I was thinking somewhere along the line of https://gist.github.com/jstnjns/3956504

@PVince81
Copy link
Contributor

might be simpler to just store the old values from toJSON() and then set them back.
not sure if it's worth adding new methods now

@felixheidecke
Copy link
Contributor

Next fun(k)y thing. It still saves even tho validation returns an error 🤔

I am going to address this as well.

@felixheidecke
Copy link
Contributor

See this PR. #32540 Too much?

@PVince81 PVince81 modified the milestones: development, QA Jan 11, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-medium Normal priority Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants