Markdown editor not accessible in 7.0.2


#1

Hi, I’m trying to use the markdown editor in my seafile 7.0.2 installation.
but I get the following error in the browser console when accessing it:

/api2/repos/519b50b4-5c94-4201-b3ef-fda9d793cd83/file/detail/?p=%2Fhome.md:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
bundle.common.ccc9d0ce6ba1.js:1 Uncaught (in promise) Error: Request failed with status code 500
    at e.exports (bundle.common.ccc9d0ce6ba1.js:1)
    at e.exports (bundle.common.ccc9d0ce6ba1.js:1)
    at XMLHttpRequest.p.onreadystatechange (bundle.common.ccc9d0ce6ba1.js:1)

In the browser itself, I can only see the loading Icon!

Any Ideas :slight_smile: ?


#2

Doesn’t work for me either.
Seafile 7.0.2 CE on Ubuntu 16.04.6 behind nginx


#3

For me neither.
Also Seafile 7.0.2 CE, Debian 9, Apache 2.


#4

If after upgrading to 7.0, you are not able to open Markdown file, it is caused by you forgot to migrate file comment when you upgrade to 6.3 version.

You can delete the table base_filecomment and recreate the table.

CREATE TABLE `base_filecomment` (

    `id` int(11) NOT NULL AUTO_INCREMENT,
  `author` varchar(255) NOT NULL,

    `comment` longtext NOT NULL,
  `created_at` datetime NOT NULL,

    `updated_at` datetime NOT NULL,
  `uuid_id` char(32) NOT NULL,

    `detail` longtext NOT NULL,
  `resolved` tinyint(1) NOT NULL,

    PRIMARY KEY (`id`),
  KEY `base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid` (`uuid_id`),

    KEY `base_filecomment_author_8a4d7e91` (`author`),

    KEY `base_filecomment_resolved_e0717eca` (`resolved`),

    CONSTRAINT `base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid` FOREIGN KEY (`uuid_id`) REFERENCES `tags_fileuuidmap` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

If you are using SQLite, the statement is

CREATE TABLE "base_filecomment" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
 "author" varchar(255) NOT NULL,
 "comment" text NOT NULL, 
"created_at" datetime NOT NULL, 
"updated_at" datetime NOT NULL, 
"uuid_id" char(32) NOT NULL REFERENCES "tags_fileuuidmap" ("uuid"), 
"detail" text NOT NULL, 
"resolved" bool NOT NULL);

#5

Creating the table didn’t change anything (SQLite).


#6

Can you check what error you have in the seahub.log?


#7

Despite having migrated the comment table in 6.3, I had a similar issue. The missing column was uuid_id according to the log. Executing @daniel.pan’s snippet fixed the issue.


#8

The fix worked for me, thanks a lot!
(using sql)


#9

Here is my seahub.log

2019-06-24 20:06:06,549 [WARNING] django.request:152 get_response Not Found: /seafile/media/assets/frontend/locales/de/translations.json
2019-06-24 20:06:06,871 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /seafile/api2/repos/5a5f4622-e0fa-4137-a629-9d081c745b33/file/detail/
Traceback (most recent call last):
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.2/seahub/seahub/api2/base.py", line 23, in dispatch
    response = super(APIView, self).dispatch(*a, **kw)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/home/seafile/seafile-server-7.0.2/seahub/seahub/api2/base.py", line 20, in handle_exception
    return super(APIView, self).handle_exception(exc)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.2/seahub/seahub/api2/views.py", line 3167, in get
    comment_total = file_comments.count()
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/db/models/query.py", line 364, in count
    return self.query.get_count(using=self.db)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/db/models/sql/query.py", line 499, in get_count
    number = obj.get_aggregation(using, ['__count'])['__count']
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/db/models/sql/query.py", line 480, in get_aggregation
    result = compiler.execute_sql(SINGLE)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
OperationalError: no such column: base_filecomment.uuid_id
2019-06-24 20:06:07,362 [WARNING] django.request:152 get_response Not Found: /seafile/media/assets/frontend/locales/en/translations.json

#10

thank you very much Daniel, it works now perfectly fine!


#11

Anyone have a hint on how to repair my database?


#12

@daniel.pan
I have exactly the same problem as @Tjelfe, can’t open the Markdown editor, similar error message.

seahub.log shows:

2019-07-06 14:11:26,060 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /lib/7d893a95-8ad8-4c52-b88a-d7392ccc8d7f/file/test.md
Traceback (most recent call last):
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/seafile/seafile-server-7.0.3/seahub/seahub/auth/decorators.py", line 27, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.3/seahub/seahub/base/decorators.py", line 74, in _decorated
    return func(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.3/seahub/seahub/views/file.py", line 680, in view_lib_file
    is_draft = is_draft_file(repo.id, path)
  File "/home/seafile/seafile-server-7.0.3/seahub/seahub/drafts/utils.py", line 42, in is_draft_file
    if draft:
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/query.py", line 258, in __nonzero__
    return type(self).__bool__(self)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/query.py", line 254, in __bool__
    self._fetch_all()
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
ProgrammingError: (1146, "Table 'seahub-db.drafts_draft' doesn't exist")

Besides all the other warnings, when running upgrade_6.3_7.0.sh the following additional warning was issued:

[WARNING] Failed to execute sql: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6) NOT NULL,\n  `updated_at` datetime(6) NOT NULL,\n  `username` varchar(255) NOT' at line 3")

[WARNING] Failed to execute sql: (1005, "Can't create table 'seahub-db.drafts_draftreviewer' (errno: 150)")

How can I create the table seahub-db.drafts_draftreviewer?


#13

It works now, it was again the datetime problem that has occurred before. Probably my SQL version is no longer supported in Debian 8. The solution is as follows:

The column type datetime(6) throws an error, removing (6) helps. To create table drafts_draft:

CREATE TABLE IF NOT EXISTS `drafts_draft` (
  `id` int(11) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `username` varchar(255) NOT NULL,
  `origin_repo_id` varchar(36) NOT NULL,
  `origin_file_version` varchar(100) NOT NULL,
  `draft_file_path` varchar(1024) NOT NULL,
  `origin_file_uuid` char(32) NOT NULL,
  `publish_file_version` varchar(100) DEFAULT NULL,
  `status` varchar(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `drafts_draft_origin_file_uuid_id_f150319e_fk_tags_file` (`origin_file_uuid`),
  KEY `drafts_draft_created_at_e9f4523f` (`created_at`),
  KEY `drafts_draft_updated_at_0a144b05` (`updated_at`),
  KEY `drafts_draft_username_73e6738b` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Now it’s possible to create drafts_draftreviewer:

CREATE TABLE IF NOT EXISTS `drafts_draftreviewer` (
  `id` int(11) NOT NULL,
  `reviewer` varchar(255) NOT NULL,
  `draft_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `drafts_draftreviewer_reviewer_e4c777ac` (`reviewer`),
  KEY `drafts_draftreviewer_draft_id_4ea59775_fk_drafts_draft_id` (`draft_id`),
  CONSTRAINT `drafts_draftreviewer_draft_id_4ea59775_fk_drafts_draft_id` FOREIGN KEY (`draft_id`) REFERENCES `drafts_draft` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Thanks @xiez that helped me again :wink: (Seafile server 6.3 is ready for testing! A WYSIWYG Markdown editor and more)


#14

You can find the correct version of mysql tables here: https://github.com/haiwen/seahub/blob/master/sql/mysql.sql

For a particular problematic table, you can delete the old table and create a new one.


#15

It’s finally working - thanks again for Your help.