Loading

Collabtive with enhanced timetracker

General Discussion around Collabtive

Re: Collabtive with enhanced timetracker

Postby some person » 09.05.2015, 11:33

Remiguel wrote:All files uploaded in Collabtive are encrypted, maybe that is an issue with tar.gz extensions?

I have just tested this and there is definitely a problem with tar.gz files in collabtive.

I am going to see if I can figure out what the problem is.
some person
 
Posts: 439
Joined: 16.04.2011, 12:46

Re: Collabtive with enhanced timetracker

Postby some person » 09.05.2015, 12:13

Remiguel wrote:All files uploaded in Collabtive are encrypted, maybe that is an issue with tar.gz extensions?

I have figured out what the problem is, collabtive is changing the file extension from tar.gz to just .gz.

By just chaning the file extension I was able to open tar.gz files.

Now next step is to figure out the code that is responsible for this, and how to fix it.
some person
 
Posts: 439
Joined: 16.04.2011, 12:46

Re: Collabtive with enhanced timetracker

Postby Remiguel » 09.05.2015, 12:15

Great!
May be it is just because of double dot .tar.gz :?
Remiguel
 
Posts: 96
Joined: 10.06.2014, 09:34
Location: Spain / France

Re: Collabtive with enhanced timetracker

Postby Remiguel » 09.05.2015, 12:22

In class.datei.php

Code: Select all
// Assemble the final filename from the original name plus the random value.
        // This is to ensure that files with the same name do not overwrite each other.
        $name = $subname . "_" . $randval . "." . $erweiterung;
Remiguel
 
Posts: 96
Joined: 10.06.2014, 09:34
Location: Spain / France

Re: Collabtive with enhanced timetracker

Postby some person » 09.05.2015, 12:27

I believe this is the code that is responsible for the bug.
Code: Select all
        // Find the extension
        $teilnamen = explode(".", $name);
        $teile = count($teilnamen);
        $workteile = $teile - 1;
        $erweiterung = $teilnamen[$workteile];

It assumes that a file always has one extension.
some person
 
Posts: 439
Joined: 16.04.2011, 12:46

Re: Collabtive with enhanced timetracker

Postby Remiguel » 09.05.2015, 12:36

So we have to cut the file name at the first dot finding and be sure during the split process to have only two portions of the name.
The last portion has to be kept to ensure to give back the file with the original extensions.

Code: Select all
// Find the extension
       $erweiterung = strstr($name, '.');
       $subname = strstr($name, '.',true);


Code: Select all
// Assemble the final filename from the original name plus the random value.
        // This is to ensure that files with the same name do not overwrite each other.
        // $erweiterung contains already the full extension and dot
        $name = $subname . "_" . $randval .  $erweiterung;
Remiguel
 
Posts: 96
Joined: 10.06.2014, 09:34
Location: Spain / France

Re: Collabtive with enhanced timetracker

Postby some person » 09.05.2015, 13:02

I think the easiest fix for this is to just allow full stops/periods in filenames.
some person
 
Posts: 439
Joined: 16.04.2011, 12:46

Re: Collabtive with enhanced timetracker

Postby some person » 09.05.2015, 15:35

While looking at the best way to fix the problem/bug, I would say the part of the code that handles filenames and extensions should be rewritten.

And probably another way should be used to figure out the file's mime type, getting it from the client is not a sure or a safe way.

Also when saving the filename, the original filename should be saved/preserved in the database, the user should never see the name of the file that was saved on the server with the random generated numbers.

The original filename is what should be presented to the client when downloading the file.
some person
 
Posts: 439
Joined: 16.04.2011, 12:46

Re: Collabtive with enhanced timetracker

Postby Remiguel » 09.05.2015, 19:46

I agree with you, end users are expecting to see the file with the exact same name they have uploaded their files.
Maybe we could proceed in 2 steps
1) Quick patch to solve the current issue.
2) Rewrite the code that handles filenames and extensions.

Unfortunately I don't know how to start for the second step. Maybe files should be saved with their unique ID in both, the server and in the field datei (with their path, in the database). That will allow to write the files name as they actually are.
Remiguel
 
Posts: 96
Joined: 10.06.2014, 09:34
Location: Spain / France

Re: Collabtive with enhanced timetracker

Postby onda » 14.05.2015, 15:55

Hi Remiguel
I've installed the app, however i can't emulate your demo, I keep getting "Notice: Use of undefined constant N - assumed 'N" when accessing users Konto on class.timetracker
and manageuser.The funcion I'm really interested in is the "timestamp" this in my opinion is by far the best way to report users time, you don't have a simplified code to this as it is taking a long time to unpick it.
Thanks again for sharing
Boa onda
onda
 
Posts: 95
Joined: 26.11.2012, 16:16

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users

cron