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

Use fileid as string in web UI #30435

Merged
merged 3 commits into from
Feb 19, 2018
Merged

Use fileid as string in web UI #30435

merged 3 commits into from
Feb 19, 2018

Conversation

PVince81
Copy link
Contributor

@PVince81 PVince81 commented Feb 9, 2018

Description

Because of limitations to JS max int, we now use strings instead of
integers.

Related Issue

Fixes #30434

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 9, 2018

  • TODO: fix sharing "item_source" and "file_source"
  • TODO: federated share "file_id" field

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 9, 2018

  • versions file id

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 9, 2018

  • comments object id...

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 9, 2018

  • activity file id...

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 9, 2018

  • previews in activity seem broken

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 9, 2018

  • gallery slideshow broken...

@codecov
Copy link

codecov bot commented Feb 9, 2018

Codecov Report

Merging #30435 into master will not change coverage.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #30435   +/-   ##
=========================================
  Coverage     61.59%   61.59%           
  Complexity    18505    18505           
=========================================
  Files          1090     1090           
  Lines         61108    61108           
=========================================
  Hits          37642    37642           
  Misses        23466    23466
Impacted Files Coverage Δ Complexity Δ
apps/files_sharing/lib/API/Remote.php 0% <0%> (ø) 12 <0> (ø) ⬇️
apps/files_sharing/lib/API/Share20OCS.php 91.64% <100%> (ø) 152 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b420d6...48140f1. Read the comment docs.

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 9, 2018

seems previews and gallery already broken on master, so likely unrelated to this change

@PVince81
Copy link
Contributor Author

PVince81 commented Feb 9, 2018

I think I've nailed most of the cases.

@phil-davis
Copy link
Contributor

phil-davis commented Feb 9, 2018

First run of drone had UI test fails at:

sharingInternalGroupsUsers
    And the sharing permissions of "User One" for "simple-folder" are set to # SharingContext::theSharingPermissionsOfAreSetTo()
| delete | no |

sharingExternalOther
    And the sharing permissions of "user1@%remote_server% (federated)" for "simple-folder" are set to # SharingContext::theSharingPermissionsOfAreSetTo()
| delete | no |

restrictSharing
    And the sharing permissions of "User One" for "simple-folder" are set to # SharingContext::theSharingPermissionsOfAreSetTo()
| share | no |

these are the only 3 places that the step the sharing permissions of "user" for "folder" are set to is used.

So I suspect that there is some issue with the sharing permissions checkboxes. I don't see immediately in the UI test code where it tries to traverse any HTML elements... that contain the file id in their xpath.

Let's see if it fails the same all the time...

Edit: the latest pushes fixed it - last 2 drone runs pass.

@PVince81
Copy link
Contributor Author

@phil-davis seems those problems disappeared?

@phil-davis
Copy link
Contributor

@PVince81 yes, after you pushed more changes it was passing, so I don't know if the first fails were just unfortunate (it seemed a big coincidence that it was sharing test steps that failed in the 3 sharing UI test suites).

@PVince81
Copy link
Contributor Author

pinging more people to review the JS changes

Copy link
Member

@VicDeo VicDeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only question is about the way of casting to string

@@ -134,7 +134,7 @@ private static function extendShareInfo($share) {
$share['mtime'] = $info->getMtime();
$share['permissions'] = $info->getPermissions();
$share['type'] = $info->getType();
$share['file_id'] = $info->getId();
$share['file_id'] = '' . $info->getId();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh

@PVince81
Copy link
Contributor Author

anything else or does the code look ok ?

Copy link
Member

@VicDeo VicDeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PVince81 I'd vote against hardcore casting by concatenation.
there are more clean ways to get string in PHP: strval(5) or (string) 5

But it's up to you.
No other objections.

@PVince81
Copy link
Contributor Author

@VicDeo ok, since you insisted I'll replace "hardcore casting" 😄

@PVince81 PVince81 force-pushed the js-fileid-as-string branch from 591a38f to e255991 Compare February 16, 2018 08:56
@PVince81
Copy link
Contributor Author

replaced 4 occurrences to strval in PHP code and rebased + squashed

@PVince81
Copy link
Contributor Author

why is this upload test failing ? it seems to not find the lorem file

@phil-davis
Copy link
Contributor

It is usually related to a lock left somewhere - I think the upload-overwrite fails because the file is already locked, then the content is checked and of course is the old content, not the expected new content.

If you get unlucky, this happens to you. This is the one I notice happening the most.

@phil-davis
Copy link
Contributor

Go to the owncloud-log step and search for locked - if that can be fixed then other troubles will go away.

@phil-davis
Copy link
Contributor

{"reqId":"tw5k1PGffGkswoDsxK13","level":0,"time":"2018-02-16T10:27:06+00:00","remoteAddr":"172.18.0.3","user":"user1","app":"core","method":"GET","url":"\/remote.php\/dav\/files\/user1\/simple-folder\/lorem.txt?c=1478997b23797c954f7ee8ea250c4c99&x=32&y=32&forceIcon=0&preview=1","message":"Generating preview for \"\/user1\/files\/simple-folder\/lorem.txt\" with \"OC\\Preview\\TXT\""}
{"reqId":"evWmtS6qlZ3OLkHVeCOM","level":4,"time":"2018-02-16T10:27:07+00:00","remoteAddr":"172.18.0.3","user":"user1","app":"webdav","method":"PUT","url":"\/remote.php\/dav\/files\/user1\/simple-folder\/lorem.txt","message":"Exception: {\"Message\":\"HTTP\\\/1.1 423 \\\"simple-folder\\\/lorem.txt\\\" is locked\",\"Exception\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Exception\\\\FileLocked\",\"Code\":0,\"Trace\":\"#0 \\\/drone\\\/src\\\/lib\\\/public\\\/Events\\\/EventEmitterTrait.php(50): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->OCA\\\\DAV\\\\Connector\\\\Sabre\\\\{closure}()\\n#1 \\\/drone\\\/src\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/File.php(258): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->emittingCall(Object(Closure), Array, 'file', 'create')\\n#2 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1129): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->put(Resource id #53)\\n#3 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(513): Sabre\\\\DAV\\\\Server->updateFile('files\\\/user1\\\/sim...', Resource id #53, NULL)\\n#4 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPut(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#5 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#6 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PUT', Array)\\n#7 \\\/drone\\\/src\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#8 \\\/drone\\\/src\\\/apps\\\/dav\\\/lib\\\/Server.php(279): Sabre\\\\DAV\\\\Server->exec()\\n#9 \\\/drone\\\/src\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#10 \\\/drone\\\/src\\\/remote.php(175): require_once('\\\/drone\\\/src\\\/apps...')\\n#11 {main}\",\"File\":\"\\\/drone\\\/src\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/File.php\",\"Line\":206,\"User\":\"user1\"}"}

suspiciously related to a "generating preview" message above it.

@PVince81
Copy link
Contributor Author

raised here: #30506

@PVince81
Copy link
Contributor Author

trying my luck again at the CI roulette...

@phil-davis
Copy link
Contributor

@PVince81 you will win if you rebase

Vincent Petry added 3 commits February 19, 2018 11:00
@PVince81
Copy link
Contributor Author

@ownclouders rebase

@ownclouders
Copy link
Contributor

Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently ⚠️

@ownclouders
Copy link
Contributor

Automated rebase with GitMate.io was successful! 🎉

@phil-davis
Copy link
Contributor

You are so lucky
https://drone.owncloud.com/owncloud/core/4034/137

+ git init
Initialized empty Git repository in /drone/src/.git/
+ git remote add origin https://github.com/owncloud/core.git
+ git fetch --no-tags --depth=50 origin +refs/pull/30435/merge:
fatal: The remote end hung up unexpectedly
exit status 128 

I restarted drone

@PVince81
Copy link
Contributor Author

thanks for the luck. maybe someone should start a service where people can pool their luck in a single location for greater luck...

@PVince81 PVince81 merged commit 731c3d8 into master Feb 19, 2018
@PVince81 PVince81 deleted the js-fileid-as-string branch February 19, 2018 14:39
@phil-davis
Copy link
Contributor

@PVince81 Is this to be backported so that these huge file ids can work in a 10.0.* release?

@PVince81
Copy link
Contributor Author

This is a bit dangerous, so no

@labkode
Copy link

labkode commented May 31, 2018

@PVince81 We will need to have this functionality for our service, do you expect to to release for 10.1.*?

@PVince81
Copy link
Contributor Author

PVince81 commented Jun 1, 2018

This will be in the next major release, yes. But not the minor one due to bigger risks.

I'm not sure whether the current automated tests already cover for all the cases touched by this PR.
If not, it would require to schedule a regression test of the complete files app and sharing UI.

@lock
Copy link

lock bot commented Jul 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Devil in the details: File ID javascript limit
5 participants