Skip to content

Commit

Permalink
new version 1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
prrvchr committed Dec 27, 2023
1 parent 2e0d8f3 commit 0afa694
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 36 deletions.
4 changes: 2 additions & 2 deletions _fascan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ output:
working_dir: .
sast:
include:
- source/mDriveOOo/service/pythonpath/mdrive/
- glob(source/mDriveOOo/service/*.py)
- /source/mDriveOOo/service/pythonpath/mdrive/
- glob(/source/mDriveOOo/service/*.py)
sca:
include:
- .
Expand Down
3 changes: 3 additions & 0 deletions packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ijson==3.2.2
packaging==23.1
six==1.16.0
2 changes: 1 addition & 1 deletion source/mDriveOOo/description.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://openoffice.org/extensions/description/2006"
xmlns:d="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
<version value="1.0.5"/>
<version value="1.0.6"/>
<identifier value="io.github.prrvchr.mDriveOOo"/>
<platform value="all"/>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions source/mDriveOOo/package.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Written by the OOEclipseIntegration
#Sat Sep 23 10:48:49 CEST 2023
contents=Common.xcu, META-INF, META-INF/manifest.xml, OAuth2OOo.xcu, Options.xcs, Options.xcu, OptionsDialog.xcu, description, description/desc_en.txt, description/desc_fr.txt, description.xml, hsqldb, hsqldb/Columns.csv, hsqldb/Settings.csv, hsqldb/TableColumn.csv, hsqldb/Tables.csv, hsqldb/hsqldb.jar, mDriveOOo, mDriveOOo/DialogStrings_en_US.default, mDriveOOo/DialogStrings_en_US.properties, mDriveOOo/DialogStrings_fr_FR.properties, mDriveOOo/LogDialog.xdl, mDriveOOo/LogWindow.xdl, mDriveOOo/OptionsDialog.xdl, mDriveOOo/OptionsDialog_en_US.default, mDriveOOo/OptionsDialog_en_US.properties, mDriveOOo/OptionsDialog_fr_FR.properties, mDriveOOo/dialog.xlb, mDriveOOo/mDriveOOo.svg, mDriveOOo.xcu, registration, registration/PrivacyPolicy_en.md, registration/PrivacyPolicy_fr.md, registration/TermsOfUse_en.md, registration/TermsOfUse_fr.md, resource, resource/ContentProvider_en_US.default, resource/ContentProvider_en_US.properties, resource/ContentProvider_fr_FR.properties, resource/Logger_en_US.default, resource/Logger_en_US.properties, resource/Logger_fr_FR.properties, resource/Replicator_en_US.default, resource/Replicator_en_US.properties, resource/Replicator_fr_FR.properties, resource/dbqueries_en_US.default, resource/dbqueries_en_US.properties, resource/dbqueries_fr_FR.properties, resource/dbtool_en_US.default, resource/dbtool_en_US.properties, resource/dbtool_fr_FR.properties, service, service/pythonpath, service/pythonpath/ijson, service/pythonpath/ijson/backends, service/pythonpath/mdrive, service/pythonpath/mdrive/dbtool, service/pythonpath/mdrive/jdbcdriver, service/pythonpath/mdrive/logger, service/pythonpath/mdrive/oauth2, service/pythonpath/mdrive/options, service/pythonpath/mdrive/ucp, service/pythonpath/mdrive/unolib, service/pythonpath/mdrive/unotool, service/pythonpath/packaging
#Wed Dec 27 15:18:06 CET 2023
contents=Common.xcu, META-INF, META-INF/manifest.xml, OAuth2OOo.xcu, Options.xcs, Options.xcu, OptionsDialog.xcu, description, description/desc_en.txt, description/desc_fr.txt, description.xml, hsqldb, hsqldb/Columns.csv, hsqldb/Settings.csv, hsqldb/TableColumn.csv, hsqldb/Tables.csv, hsqldb/hsqldb.jar, mDriveOOo, mDriveOOo/DialogStrings_en_US.default, mDriveOOo/DialogStrings_en_US.properties, mDriveOOo/DialogStrings_fr_FR.properties, mDriveOOo/LogDialog.xdl, mDriveOOo/LogWindow.xdl, mDriveOOo/OptionsDialog.xdl, mDriveOOo/OptionsDialog_en_US.default, mDriveOOo/OptionsDialog_en_US.properties, mDriveOOo/OptionsDialog_fr_FR.properties, mDriveOOo/dialog.xlb, mDriveOOo/mDriveOOo.svg, mDriveOOo.xcu, registration, registration/PrivacyPolicy_en.md, registration/PrivacyPolicy_fr.md, registration/TermsOfUse_en.md, registration/TermsOfUse_fr.md, resource, resource/ContentProvider_en_US.default, resource/ContentProvider_en_US.properties, resource/ContentProvider_fr_FR.properties, resource/Logger_en_US.default, resource/Logger_en_US.properties, resource/Logger_fr_FR.properties, resource/Replicator_en_US.default, resource/Replicator_en_US.properties, resource/Replicator_fr_FR.properties, resource/dbqueries_en_US.default, resource/dbqueries_en_US.properties, resource/dbqueries_fr_FR.properties, resource/dbtool_en_US.default, resource/dbtool_en_US.properties, resource/dbtool_fr_FR.properties, service, service/NamedProvider.py, service/OptionsHandler.py, service/UnamedProvider.py, service/mDriveOOo.py, service/pythonpath, service/pythonpath/ijson, service/pythonpath/ijson/__init__.py, service/pythonpath/ijson/backends, service/pythonpath/ijson/backends/__init__.py, service/pythonpath/ijson/backends/_yajl2.cp38-win32.pyd, service/pythonpath/ijson/backends/_yajl2.cp38-win_amd64.pyd, service/pythonpath/ijson/backends/_yajl2.cpython-310-x86_64-linux-gnu.so, service/pythonpath/ijson/backends/_yajl2_ctypes_common.py, service/pythonpath/ijson/backends/python.py, service/pythonpath/ijson/backends/yajl.py, service/pythonpath/ijson/backends/yajl2.py, service/pythonpath/ijson/backends/yajl2_c.py, service/pythonpath/ijson/backends/yajl2_cffi.py, service/pythonpath/ijson/common.py, service/pythonpath/ijson/compat.py, service/pythonpath/ijson/dump.py, service/pythonpath/ijson/utils.py, service/pythonpath/ijson/utils35.py, service/pythonpath/ijson/version.py, service/pythonpath/mdrive, service/pythonpath/mdrive/__init__.py, service/pythonpath/mdrive/configuration.py, service/pythonpath/mdrive/contentprovider.py, service/pythonpath/mdrive/database.py, service/pythonpath/mdrive/datasource.py, service/pythonpath/mdrive/dbconfig.py, service/pythonpath/mdrive/dbinit.py, service/pythonpath/mdrive/dbqueries.py, service/pythonpath/mdrive/dbtool, service/pythonpath/mdrive/dbtool/__init__.py, service/pythonpath/mdrive/dbtool/array.py, service/pythonpath/mdrive/dbtool/dbtool.py, service/pythonpath/mdrive/dbtool/object.py, service/pythonpath/mdrive/jdbcdriver, service/pythonpath/mdrive/jdbcdriver/__init__.py, service/pythonpath/mdrive/jdbcdriver/configuration.py, service/pythonpath/mdrive/logger, service/pythonpath/mdrive/logger/__init__.py, service/pythonpath/mdrive/logger/dialog, service/pythonpath/mdrive/logger/dialog/__init__.py, service/pythonpath/mdrive/logger/dialog/loghandler.py, service/pythonpath/mdrive/logger/dialog/loglistener.py, service/pythonpath/mdrive/logger/dialog/logmanager.py, service/pythonpath/mdrive/logger/dialog/logmodel.py, service/pythonpath/mdrive/logger/dialog/logview.py, service/pythonpath/mdrive/logger/logger.py, service/pythonpath/mdrive/logger/loggerpool.py, service/pythonpath/mdrive/logger/loghandler.py, service/pythonpath/mdrive/logger/loghelper.py, service/pythonpath/mdrive/oauth2, service/pythonpath/mdrive/oauth2/__init__.py, service/pythonpath/mdrive/oauth2/configuration.py, service/pythonpath/mdrive/oauth2/oauth2core.py, service/pythonpath/mdrive/oauth2/oauth2lib.py, service/pythonpath/mdrive/oauth2/oauth2tools.py, service/pythonpath/mdrive/options, service/pythonpath/mdrive/options/__init__.py, service/pythonpath/mdrive/options/optionsmanager.py, service/pythonpath/mdrive/options/optionsmodel.py, service/pythonpath/mdrive/options/optionsview.py, service/pythonpath/mdrive/provider.py, service/pythonpath/mdrive/replicator.py, service/pythonpath/mdrive/ucp, service/pythonpath/mdrive/ucp/__init__.py, service/pythonpath/mdrive/ucp/content.py, service/pythonpath/mdrive/ucp/contenthelper.py, service/pythonpath/mdrive/ucp/contentlib.py, service/pythonpath/mdrive/ucp/contentlistener.py, service/pythonpath/mdrive/ucp/identifier.py, service/pythonpath/mdrive/ucp/provider.py, service/pythonpath/mdrive/ucp/user.py, service/pythonpath/mdrive/unolib, service/pythonpath/mdrive/unolib/__init__.py, service/pythonpath/mdrive/unolib/unocore.py, service/pythonpath/mdrive/unolib/unolib.py, service/pythonpath/mdrive/unotool, service/pythonpath/mdrive/unotool/__init__.py, service/pythonpath/mdrive/unotool/unotool.py, service/pythonpath/packaging, service/pythonpath/packaging/__init__.py, service/pythonpath/packaging/_elffile.py, service/pythonpath/packaging/_manylinux.py, service/pythonpath/packaging/_musllinux.py, service/pythonpath/packaging/_parser.py, service/pythonpath/packaging/_structures.py, service/pythonpath/packaging/_tokenizer.py, service/pythonpath/packaging/markers.py, service/pythonpath/packaging/metadata.py, service/pythonpath/packaging/py.typed, service/pythonpath/packaging/requirements.py, service/pythonpath/packaging/specifiers.py, service/pythonpath/packaging/tags.py, service/pythonpath/packaging/utils.py, service/pythonpath/packaging/version.py, service/pythonpath/six.py
2 changes: 1 addition & 1 deletion source/mDriveOOo/service/NamedProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationName = '%s.NamedProvider' % g_identifier
g_ImplementationName = f'{g_identifier}.NamedProvider'


class NamedProvider(unohelper.Base,
Expand Down
4 changes: 2 additions & 2 deletions source/mDriveOOo/service/OptionsHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationName = '%s.OptionsHandler' % g_identifier
g_ImplementationName = f'{g_identifier}.OptionsHandler'


class OptionsHandler(unohelper.Base,
Expand Down Expand Up @@ -85,7 +85,7 @@ def callHandlerMethod(self, window, event, method):
handled = True
return handled
except Exception as e:
msg = "OptionsHandler.callHandlerMethod() Error: %s" % traceback.format_exc()
msg = f'OptionsHandler.callHandlerMethod() Error: {e}\n{traceback.format_exc()}'
print(msg)

def getSupportedMethodNames(self):
Expand Down
2 changes: 1 addition & 1 deletion source/mDriveOOo/service/UnamedProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

# pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationName = '%s.UnamedProvider' % g_identifier
g_ImplementationName = f'{g_identifier}.UnamedProvider'


class UnamedProvider(unohelper.Base,
Expand Down
50 changes: 23 additions & 27 deletions source/mDriveOOo/service/pythonpath/mdrive/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _parseSharedFolder(self, request, parameter, parent, timestamp):
parents = [parent, ]
trashed = rename = readonly = versionable = False
addchild = True
path = None
path = ''
while parameter.hasNextPage():
response = request.execute(parameter)
if response.Ok:
Expand All @@ -130,9 +130,10 @@ def _parseSharedFolder(self, request, parameter, parent, timestamp):
parser.send(iterator.nextElement().value)
for prefix, event, value in events:
if (prefix, event) == ('value.item', 'start_map'):
itemid = link = name = None
itemid = name = None
created = modified = timestamp
mimetype = g_folder
link = ''
size = 0
elif (prefix, event) == ('value.item.remoteItem.id', 'string'):
itemid = value
Expand All @@ -149,18 +150,19 @@ def _parseSharedFolder(self, request, parameter, parent, timestamp):
elif (prefix, event) == ('value.item.remoteItem.file.mimeType', 'string'):
mimetype = value
elif (prefix, event) == ('value.item', 'end_map'):
yield itemid, name, created, modified, mimetype, size, link, trashed, addchild, rename, readonly, versionable, path, parents
if itemid and name:
yield itemid, name, created, modified, mimetype, size, link, trashed, addchild, rename, readonly, versionable, path, parents
del events[:]
parser.close()
response.close()

def parseRootFolder(self, parameter, content):
return self.parseItems(content.User.Request, parameter, content.Link)

def parseItems(self, request, parameter, link=None):
def parseItems(self, request, parameter):
readonly = versionable = False
addchild = rename = True
path = None
path = link = ''
while parameter.hasNextPage():
response = request.execute(parameter)
if response.Ok:
Expand Down Expand Up @@ -199,7 +201,8 @@ def parseItems(self, request, parameter, link=None):
elif (prefix, event) == ('value.item.parentReference.id', 'string'):
parents.append(value)
elif (prefix, event) == ('value.item', 'end_map'):
yield itemid, name, created, modified, mimetype, size, link, trashed, addchild, rename, readonly, versionable, path, parents
if itemid and name:
yield itemid, name, created, modified, mimetype, size, link, trashed, addchild, rename, readonly, versionable, path, parents
del events[:]
parser.close()
response.close()
Expand Down Expand Up @@ -339,31 +342,24 @@ def _parseRoot(self, response):

def parseUploadLocation(self, response):
url = None
if not response.Ok:
print("Provider.parseUploadLocation() Text: %s" % response.Text)
else:
events = ijson.sendable_list()
parser = ijson.parse_coro(events)
iterator = response.iterContent(g_chunk, False)
while iterator.hasMoreElements():
parser.send(iterator.nextElement().value)
for prefix, event, value in events:
if (prefix, event) == ('uploadUrl', 'string'):
url = value
del events[:]
parser.close()
events = ijson.sendable_list()
parser = ijson.parse_coro(events)
iterator = response.iterContent(g_chunk, False)
while iterator.hasMoreElements():
parser.send(iterator.nextElement().value)
for prefix, event, value in events:
if (prefix, event) == ('uploadUrl', 'string'):
url = value
del events[:]
parser.close()
response.close()
return url

def updateItemId(self, database, oldid, response):
if response is not None:
if response.Ok:
newid = self._parseNewId(response)
if newid and oldid != newid:
database.updateItemId(newid, oldid)
return newid
response.close()
return None
newid = self._parseNewId(response)
if newid and oldid != newid:
database.updateItemId(newid, oldid)
return newid

def _parseNewId(self, response):
newid = None
Expand Down

0 comments on commit 0afa694

Please sign in to comment.